SQL DDL Command

Last Updated on

Data Definition Language

SQL statements that can be used either interactively or within programming language source code to define databases and their components.

1. CREATE: used to create a table in database

Syntax: CREATE table table_name
attributes1 domain type
attributes2 domain type
attributes n domain type


2. ALTER: use to change the table definition i.e changing attribute definitions

i. To add new column in database:

Syntax:ALTER TABLE table_name
ADD column_name datatype;

Example: alter table student add address varchar(25)

ii. To modify datatypes of column:

Syntax:ALTER TABLE table_name ALTER Column column_name datatype;

Example:ALTER TABLE student ALTER Column phone bigint;

iii. To delete column from database:

Syntax:ALTER TABLE table_name DROP Column column_name;

Example: ALTER TABLE student DROP Column phone;

3. DROP: drop command delete the table from database

Syntax:DROP TABLE table_name;

Example: DROP TABLE student

4. TRUNCATE: used to delete all record of the given table

Syntax:TRUNCATE TABLE table_name;

Example: TRUNCATE TABLE student;


Leave a Reply

SQL DDL Command

by Nabaraj Paudel time to read: 1 min