DBMS Lab 2
DBMS Lab 2
CSPC-222
Lab-Assignment 2
(Simple DML and DDL Queries)
1
SALAMT Number 8,2
TGTTOGET Number 6,2
YTDSALES Number 6,2
REMARKS Varchar2 60
Source Code:
2
PINCODE int(8),
STATE varchar(20),
SALAMT float(8,2),
TGTTOGET float(6,2),
YTDSALES float(6,2),
REMARKS varchar(60)
);
SHOW tables;
Output:
Source Code:
4
("P06734","COTTON JEANS",5,"PIECE",50,15,600,433),
("P0785","JEANS",5,"PIECE",670,20,632,100),
("P07868","TROUSERS",5,"PIECE",100,20,600,322),
("P07885","PULL OVERS",2.5,"PIECE",300, 46,400,200),
("P07965","DENIM SHIRTS",4,"PIECE",470, 50,700,430),
("P0975","LYCRA TOPS",5,"PIECE",450,67,300,500),
("P08865","SKIRTS",5,"PIECE",500,46,765,800);
SELECT * FROM PRODUCT_MASTER;
Output:
a. Find out all the tables present in the current database and other databases.
b. Find out the names of all the clients.
c. Retrieve the entire contents of the CLIENT_MASTER table.
d. Retrieve the list of names, city, and state of all the clients.
e. List the various products available from the PRODUCT_MASTER table.
f. List all the clients who are located in Mumbai.
5
g. Find the names of the salesman who have a salary equal to Rs. 3000.
Source Code:
a : show tables;
b: select name from CLIENT_MASTER;
c : select * from CLIENT_MASTER;
d : select name,city,state from CLIENT_MASTER;
e : select description from PRODUCT_MASTER;
f : select * from CLIENT_MASTER where city=Mumbai;
Output:
6
Program 4: Exercise On Updating Records from a table
a : Change the city of client no “C00005” to banglore
b : Change the balance due of client no “C00001” to Rs 1000
c : Change the costprice of trousers to 950
Source Code:
a : update CLIENT_MASTER
set City="BANGLORE"
where CLIENTNO = "C00005";
b : update CLIENT_MASTER
7
set baldue=1000
where CLIENTNO = "C00001";
c : update PRODUCT_MASTER
set COSTPRICE=950
where DESCRIPTION = "TROUSERS";
Output:
Source code:
Output:
Source Code:
9
a : alter table client_master
add column telephone int(10);
b : alter table product_master
modify sellprice float(10,2);
Output:
Source Code:
Output:
10
11
12