Professional Documents
Culture Documents
The Database Language SQL: Data Definition Language (DDL) Commands
The Database Language SQL: Data Definition Language (DDL) Commands
◼ CREATE:
• The SQL CREATE TABLE statement is used to create a new table.
• Creating a basic table involves naming the table and defining its columns and each column's data type.
◼ Syntax:
• Basic syntax of CREATE TABLE statement is as follows:
CREATE TABLE table_name
(column1 datatype (size),
column2 datatype (size),
column3 datatype (size) ... columnN datatype (size),
PRIMARY KEY (one or more columns));
Example: SQL>
Syntax:
• The basic syntax of ALTER TABLE to add a new column in an existing table is as follows:
• The basic syntax of ALTER TABLE to ADD PRIMARY KEY constraint to a table is as follows:
DROP:
• SQL DROP TABLE statement is used to remove a table definition and all data, indexes, triggers, constraints, and
permission specifications for that table.
Syntax:
Basic syntax of DROP TABLE statement is as follows: