Data Definition Language(DDL): These commands are used to make changes to the Database object structure(CREATE,DROP,ALTER,TRUNCATE)
CREATE: Create database,table,index or view
CREATE Database Superstore;
CREATE Table Employees(
Employee ID int,
Employee Name varchar(10),
Employee DOB Date
);
DROP: Drop database,table
Drop Database Superstore;
Drop Table Employees;
ALTER: Alter command is used to modify the structure of database object like table
1.Add a column:
ALTER table Employees
ADD column Email varchar(30);
2.Drop a column:
ALTER table Employees
Drop column Email;
3.Modify a column:
ALTER table Employees
Modify column DOB DATETIME;
4.Rename a column:
ALTER table Employees
Rename column DOB to DateBirth;
5.Rename a table:
RENAME TABLE Employees to Staff;
TRUNCATE: Truncate command is used to remove all the rows in a table but the structure remains the same
TRUNCATE table Employees;