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

Database Management System (DBMS) Lab Assignment 03

1. Create the following Table:


A. Table Name : Client_Master
Column Name Data Type Size Constraints
Client_No Varchar 10 Primary Key
Name Varchar 20 Not Null
Address Varchar 30
State Varchar 30
City Varchar 15
Pin_Code Number 10
Data for Client_Master Table:
Client_No Name Address State City Pin_Code
C10011 Akash Nehru Place Delhi New Delhi 110001
C10012 Amit Golconda Telangana Hyderabad 500008
C10013 Deepak Bidhan Nagar Kolkata Kolkata 700091
C10014 Jayant Asifnagar Telangana Hyderabad 500028
C10015 Geeta Chomu Rajasthan Jaipur 303702
C10016 Ravi Janpath Delhi New Delhi 110001

B. Table Name : Product_Master


Column Name Data Type Size Constraints
Product_No Varchar 10 Primary Key
Description Varchar 20 Not Null
Profit_Percent Number 2.2 Not Null
Qty_On_Hand Number 8 Not Null
Sell_Price Number 8.2 Not Null
Cost_Price Number 8.2 Not Null
Data for Product_Master Table:
Product_No Description Profit_Percent Qty_On_Hand Sell_Price Cost_Price
P2100021 Monitors 6 10 12000 11280
P2100022 Mouse 5 20 1050 1000
P2100023 1.44 Floppies 5 100 525 500
P2100024 1.22 Floppies 5 100 525 500
P2100025 Keyboards 2 10 315 300
P2100026 Cd Drive 2.5 10 5250 5100
P2100027 Harddisk 4 10 9000 8500
P2100028 1.44 Drive 5 10 1050 1000
P2100029 1.22 Drive 5 2 1050 1000
C. Table Name : Sales_Order
Column Name Data Type Size Constraints
S_Order_No Varchar 10 Primary Key
S_Order_Date Date
Client_No Varchar 10 Foreign Key references
Client_No of Client_Master
Table
Salesman_No Varchar 10 Should start with S
Product_No Varchar 10 Foreign Key references
Product_No of Product_Master
Table

Data for Sales_Order Table:


S_Order_No S_Order_Date Client_No Salesman_No Product_No
O510011 2021-08-25 C10011 S000019 P2100021
O510012 2021-04-24 C10012 S000018 P2100022
O510013 2021-08-02 C10013 S000017 P2100023
O510014 2021-06-10 C10014 S000016 P2100024
O510015 2021-08-23 C10015 S000015 P2100025
O510016 2021-07-18 C10016 S000014 P2100026

2. Display the structure of the entire table.


3. Display all the tables along with data.
4. Add a Not Null Constraint on the Address field of Client_Master table and display the structure of
the table.

5. A. Check how entity integrity constraint is enforced in all the 3 tables. Show all the
conditions are enforced.
B. Check how domain integrity constraint is enforced in the Sales_Order table.
6. Change the S_Order_Date of Client_No ‘C10011’ to ‘2021-03-24’, Product_No to ‘P2100027’
and Salesman_No to ‘S000014’.
7. Change the selling price of ‘1.44 Floppy Drive’ to Rs 1150.
8. Change the city of Client_No ‘C10011’ to ‘Janpath’.
9. Add a column Bal_Due to the table Client_Master with data type number (10,2). Insert the values
according to your wish.
10. Change the field size of Client_No to 15 in all the table where the filed Client_No is present.
11. Change the Client_No for S_Order_No O510015 to C10014 in Sales Order table. Note down the
error, if any.
12. Remove the foreign key constraint referencing Product_Master table from the Sales_Order table.
13. Remove the foreign Key constraint referencing Client_Master table from the Sales_Order table.
14. Display the structure of all tables.
15. Remove the record for Client no C10015 from Client_Master table.

16. Remove those records from Product_Master table for which Sell_Price is between 1000 and
10000.
17. Remove the column Profit_Percent from Products Master table.
18. Delete all the records from Products_Master table. (Use delete)

19. Delete all records from Client_Master table. (Use Turncate)


20. Delete the table Sales_Order.

You might also like