Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

What is DDL (Data Definition Language):

It is actually the SQL commands that are used to define the database schema that are referred
to as DDL, or Data Definition Language (DDL). It deals with nothing more complicated than
descriptions of the database schema, and it is used to create and modify the structure of
database objects in the database. DDL is a collection of SQL commands that are used to
create, modify, and delete database structures, but not their contents. These commands
should be used by the database administrator and should not be used by a general or non-
technical users, as modifying the database schema by a such user may result in the loss of the
schema structure and its data.

List of DDL commands:

• CREATE : The database or its objects are created with this command (like table,
index, function, views, store procedure, and triggers).
• DROP : Objects can be removed from the database using this command.
• ALTER : The ALTER command is used to change the database's structure.
• RENAME : In order to rename an existing object in a database, you can use this
command.
Consider the following relational model.

1. Write an sql statement to create a database called company and then create the above
tables.
Note: The following restrictions should be enforced.
• Try different ON DELETE and ON UPDATE constraints when setting the
foreign keys.
• The purchase amount (purch_amt) column in the Order table should always
contain a value greater than 0.
• The customer table's grade should range from 0 to 1000.
• Set default salesman_id as ‘5001’ in the Order table.

2. Add a new column to the Customer table as customer_age


3. Change name of the ord_date column of Order table as ordered_date.
4. Delete the city column of the Salesman table.
5. Delete the Customer table.
6. Delete the database schema.

You might also like