0% found this document useful (0 votes)
29 views9 pages

Database Fundamentals Lab2

The document discusses Data Definition Language (DDL) commands in database fundamentals. It describes DDL commands like Create, Alter, Truncate, Drop, and Rename. The Create command is used to create new tables or databases. An example is provided to create a table named "Employee" with columns for Name, Email, and Date of Birth. The Alter command is used to modify existing tables, such as adding a check constraint to only allow certain values in an address column.

Uploaded by

someya mohsen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views9 pages

Database Fundamentals Lab2

The document discusses Data Definition Language (DDL) commands in database fundamentals. It describes DDL commands like Create, Alter, Truncate, Drop, and Rename. The Create command is used to create new tables or databases. An example is provided to create a table named "Employee" with columns for Name, Email, and Date of Birth. The Alter command is used to modify existing tables, such as adding a check constraint to only allow certain values in an address column.

Uploaded by

someya mohsen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 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