Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

MySQL - Database

Rating
-
Sold
-
Pages
2
Uploaded on
09-08-2024
Written in
2023/2024

Stay organized and boost your learning with these easy-to-follow class notes! They summarize key concepts, important details, and essential ideas from your lessons, making studying a breeze. Perfect for students at any level, these notes will help you prepare for exams and reinforce what you’ve learned. Get your copy today and make studying easier!

Show more Read less
Institution
Course

Content preview

MySQL DATABASE The ALTER TABLE statement is used to add, delete, or
modify columns in an existing table. The ALTER
 The CREATE DATABASE statement is used to
TABLE statement is also used to add and drop various
create a new SQL database.
constraints on an existing table.
Syntax:
 ALTER TABLE - ADD Column
CREATE DATABASE databasename;
To add a column in a table, use the following syntax:
CREATE DATABASE testDB;
ALTER TABLE table_name
ADD column_name datatype;

 The DROP DATABASE statement is used to drop ALTER TABLE Customers
an existing SQL database. ADD Email varchar (255);

Syntax:  ALTER TABLE - DROP COLUMN

DROP DATABASE databasename; To delete a column in a table, use the following syntax
(notice that some database systems don't allow deleting a
DROP DATABASE testDB; column):
ALTER TABLE table_name
 The CREATE TABLE statement is used to create a DROP COLUMN column_name;
new table in a database. ALTER TABLE Customers
Syntax: DROP COLUMN Email;

CREATE TABLE table_name (  ALTER TABLE - MODIFY COLUMN
column1 datatype, To change the data type of a column in a table, use the
column2 datatype, following syntax:
column3 datatype,
.... ALTER TABLE table_name
); MODIFY COLUMN column_name datatype;

CREATE TABLE Persons ( ALTER TABLE Persons
PersonID int, ADD DateOfBirth date;
LastName varchar(255),
 DROP COLUMN
FirstName varchar(255),
Address varchar(255), Example
City varchar(255)
Next, we want to delete the column named
);
"DateOfBirth" in the "Persons" table.
We use the following SQL statement:
 The DROP TABLE statement is used to drop an
Example
existing table in a database.
ALTER TABLE Persons
Syntax:
DROP COLUMN DateOfBirth;
DROP TABLE table_name;
DROP TABLE Shippers;

Written for

Institution
Course

Document information

Uploaded on
August 9, 2024
Number of pages
2
Written in
2023/2024
Type
Class notes
Professor(s)
Ms. castro
Contains
All classes

Subjects

$10.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
principeshanep

Get to know the seller

Seller avatar
principeshanep Southern Leyte State University
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
1 year
Number of followers
0
Documents
8
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions