0% found this document useful (0 votes)
33 views

Lab 1 Sol

Two tables were created - client_master to store client details and product_master to store product details. Data was inserted into both tables. Several queries were written to retrieve data from the tables based on conditions. The queries included finding client names, listing clients by city, retrieving products by description, finding products by sell price range, and listing clients not in a particular state.

Uploaded by

krishnanand
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Lab 1 Sol

Two tables were created - client_master to store client details and product_master to store product details. Data was inserted into both tables. Several queries were written to retrieve data from the tables based on conditions. The queries included finding client names, listing clients by city, retrieving products by description, finding products by sell price range, and listing clients not in a particular state.

Uploaded by

krishnanand
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

TABLE:client_master

createtableclient_master
(client_no
varchar2(6)primarykey,
name
varchar2(20),
address1
varchar2(30),
address2
varchar2(30),
city

varchar2(15),
state
varchar2(15),
pincodenumber(6),
bal_due
number(10,2)
);

Insertthefollowingdataintotable:

insertintoclient_mastervalues('0001', 'Ivan','','',
'Bombay',
'Maharashtra',400054, 15000);
insertintoclient_mastervalues('0002', 'Vandana','','', 'Madras'
,'Tamilnadu',780001, 0);
'Maharashtra',400057, 5000);
insertintoclient_mastervalues('0003', 'Pramada','','', 'Bombay',
insertintoclient_mastervalues('0004', 'Basu','','',
'Bombay'
,'Maharashtra',400056, 0);
insertintoclient_mastervalues('0005', 'Ravi','','',
'Delhi' ,'',100001,
2000);
insertintoclient_mastervalues('0006', 'Rukmini','','', 'Bombay',
'Maharashtra', 400050,

0);

TABLE:Product_master
createtableproduct_master
(
product_no
varchar2(6)primarykey,
description
varchar2(20),
profit_percent number(5,2),
unit_measure varchar2(8),
qty_on_hand number(6),
reoder_lvl
number(6),
sell_price
number(10),
cost_price
number(10));

Insertthefollowingdataintotable:

insertintoproduct_mastervalues('P00001', '1.44floppies', 5,
'piece', 100, 20,
525,

500);
insertintoproduct_mastervalues('P03453',
'Monitors',6, 'piece', 10,
3,
12000, 11200);
insertintoproduct_mastervalues('P06734',
'Mouse',5,
'piece',
20,
5,
1050,

500);

insertintoproduct_mastervalues('P07865',
'1.22floppies', 5,
'piece',100, 20,
525,

500);
insertintoproduct_mastervalues('P07868',
'Keyboards',2,'piece', 10,
3,
3150, 3050);
insertintoproduct_mastervalues('P07885',
'CDDrive',2.5, 'piece',10,
3,
5250, 5100);
insertintoproduct_mastervalues('P07965',
'540HDD',4,'piece', 10,
3,
8400, 8000);
3,
1050, 1000);
insertintoproduct_mastervalues('P07975',
'1.44Drive',5,'piece', 10,
insertintoproduct_mastervalues('P08865',
'1.22Drive',5,'piece',2,
3,
1050, 1000);

QUERIESONBOTHTABLES:

i)Findoutthenamesofalltheclients.
selectnamefromclient_master;

ii)
Retrievethelistofnamesandcitiesofalltheclients.
selectclient_no,name,cityfromclient_master;

iii)
Listthevariousproductsavailablefromtheproduct_mastertable.
selectproduct_no,descriptionfromproduct_master;

iv)
ListalltheclientswhoarelocatedinBombay.
selectclient_no,namefromclient_masterwherecity=Bombay;

v)
Displaytheinformationforclientno0001and0002.
select*fromclient_masterwhereclient_noin(0001,0002);

vi)
Findtheproductswithdescriptionas1.44driveand1.22Drive.
select*fromproduct_masterwheredescriptionin(1.44Drive,1.22Drive);

vii)
Findalltheproductswhosesellpriceisgreaterthen5000.
select*fromproduct_masterwheresell_price>5000;

viii)
FindthelistofallclientswhostayinincityBombayorcityDelhiorMadras.
select*fromclient_masterwherecityin(Bombay,Delhi,Madras);

ix)
Findtheproductwhosesellingpriceisgreaterthan2000andlessthanorequalto5000.
select*fromproduct_masterwheresell_pricebetween2000and5000;

Listthename,cityandstateofclientsnotinthestateofMaharashtra.
x)
selectname,city,statefromclient_masterwherestate=Maharashtra;

You might also like