You are on page 1of 9

Database Fundamentals

Lab 2
DDL: Data Definition Language
All DDL commands are auto-committed.
That means it saves all the changes
permanently in the database.
Command Description

Create To create a new table or


database
Alter For alteration

Truncate To delete data from table

Drop To drop a table

Rename To rename a table/column


Data Definition Language :
Create command
Create is a DDL command used to create
a table or a database.

Example for creating table:-


Create table Employee(Name varchar(20), Email varchar(100), DOB data);
- The above command will create a new table named employee in the database
system with 3 columns named (Name, Email, DOB)
Constraints
Constraints….
Constraints….
Constraints….
Constraints….

Alter table persons alter address varchar(20) check (address in (‘minya’,


‘cairo’))
or
ALTER TABLE Persons ADD CHECK (Age>=18);
Constraints….

You might also like