Page 1 - Home Assignment-DDL and DML commands
P. 1
Computer Science
Class – XII
Topic: DDL and DML Commands
1. Write SQL command to:
a. To list names of all databases in root.
b. To show the name of active database.
c. Create a database school
d. To open the created database school
e. To delete the database school
2. What is a constraint? What are the different types of constraints in SQL.
3. Explain the following constraints. Explain the same by taking one SQL command.
a. not null
b. unique
c. default
d. check
e. primary key
f. foreign key
4. Observe the following table carefully and write the names of the most appropriate
columns, which can be considered as (i) candidate keys and (ii) primary key :
Code Item Qty Price Transaction Date
1001 Plastic Folder 14’’ 100 3400 2014-12-14
1004 Pen Stand Standard 200 4500 2015-01-31
1005 Stapler Mini 250 1200 2015-02-28
1009 Punching Machine Small 200 1400 2015-03-12
1003 Stapler Big 100 1500 2015-02-02
5. Write SQL command to create above table where Item Code is the primary key and
entries in the item column is not null and unique.
6. Consider following tables:
Table: SUPPLIERS
SUPCODE SNAME CITY
(pri key) (not null) (not null)
S01 GET ALL INC KOLKATA
S02 EASY MARKET CORP DELHI
S03 DIGI BUSY GROUP CHENNAI