Data Definition Language
Data Definition Language
Data Definition Language
Language.
DDL stands for Data Definition Language.
These commands are used to change the structure of a database
and database objects
DATABASE ADMINISTRATIVE AND
MANAGEMENT SYSTEM
PRACTICAL
DDL Operations
CREATE
ALTER
DROP
TRUNCATE
RENAME
CREATE TABLE TABLE_NAME (
The column_name in create table command will tell the name of the
column and corresponding datatype will specify the datatype of that
column.Here in this table the three column_names namely –
Student_id is of type int ,Name is of type varchar and Marks is of type
int.
for example:
CREATE TABLE
Employee
(Student_id INT,
Name VARCHAR(100),
Marks INT);
DDL Operations continue
2. ALTER :
Alter command is used for altering the table in many forms like:
Add a column
Rename existing column
Drop a column
Modify the size of the column or change datatype of the column
DDL Operations continue
Here this command will add a new column “Address” in the table
Student of datatype varchar(200);
The above command will rename the existing column to new column.
DDL Operations continue
ALTER TABLE
Employee
RENAME
Marks TO Age;
The command above will change the column_name from Marks to
Age;
Example: