MySQL CREATE, DROP AND ALTER TABLE
CREATE TABLE
The CREATE TABLE statement is used to create a new table.
SYNTAX:
EXAMPLE:
The following SQL statement creates a Table called "student_details":
create table students_details (student_id int, student_name nvarchar(200), student_address nvarchar(200)); |
SYNTAX:
EXAMPLE:
The following SQL statement drop a table called "students_details":
drop table students_details; |
ALTER TABLE
SYNTAX:
EXAMPLE:
The following SQL statement add a table column called "students_email":
alter student_details add (students_email nvarchar(200)); |
SYNTAX:
EXAMPLE:
The following SQL statement drop a table column called "students_email":
alter student_details drop column students_email; |
SYNTAX:
EXAMPLE:
The following SQL statement rename a table column called "students_address to students_lastname":
alter student_details rename column students_address to students_lastname; |