Create, Alter & Drop Table


Create Table


The SQL CREATE TABLE statement is used to create a new table.


Basic syntax of CREATE TABLE statement is as follows:

CREATE TABLE table_name(

column1 datatype,

column2 datatype,

column3 datatype,


columnN datatype,

PRIMARY KEY( one or more columns )


CREATE TABLE is the keyword telling the database system what you want to this case, you want to create a new table. The unique name or identifier for the table follows the CREATE TABLE statement.

Then in brackets comes the list defining each column in the table and what sort of data type it is. The syntax becomes clearer with an example below.


Alter table

The ALTER TABLE statement is used to add, delete, or modify columns in an existing table.


To add a column in a table, use the following syntax:

ALTER TABLE table_name
ADD column_name datatype

To delete a column in a table, use the following syntax (notice that some database systems don’t allow deleting a column):

ALTER TABLE table_name
DROP COLUMN column_name


Drop Table


The SQL DROP TABLE statement is used to remove a table definition and all data, indexes, triggers, constraints, and permission specifications for that table.

NOTE: You have to be careful while using this command because once a table is deleted then all the information available in the table would also be lost forever.


Basic syntax of DROP TABLE statement is as follows:

DROP TABLE table_name;












A password will be e-mailed to you.

Feedback Form

[contact-form-7 id="98" title="Feedback Form"]