Medical Agency Project
Medical Agency Project
Agency
Database
Project
Made by :
EMP_NO EMP_NAME
------------ --------------------
101 rakesh
102 jitesh
103 ravi
104 salil
105 milind
M_EMP_NO M_MED_NO
---------------- ----------
101 4
102 1
103 3
104 2
105 5
GIV_MED_NO GIV_D_NO
---------- ----------
3 1000
1 2000
5 3000
4 1000
2 2000
S_ID S_NAME
---------- --------------------
1 yogesh
2 samir
3 firoz
4 gaurav
5 viral
W_S_ID W_D_NO
---------- ----------
1 1000
2 2000
3 1000
4 3000
5 2000
S_ID ORDER_NO
---------- ----------
1 10
2 20
SQL QUERIES :
1. Give the name of a medicine which is sold to distributor ranbaxy.
SQL> select med_name from medicine where med_no = (select giv_med_no from
gives_to where giv_d_no=(select d_no from med_distributor where
d_name='thyrocare'))
MED_NAME
--------------------
disprin
MED_NAME
--------------------
ciplox
SQL> update orders set ord_qty = 600 where ord_store_id = (select store_id from
med_store where store_name='laxmi');
1 row updated.
SQL> select ord_qty from orders where ord_s_id=(select s_id from salesman where
s_name= 'yogesh');
ORD_QTY
---------------
200
MED_NAME
--------------------
disprin
MED_NAME
--------------------
ciplox
7. Give the name and location of the medical store which has ordered the most
amount of any medicine from the distributor.
STORE_NAME STORE_LOC
-------------------- ---------------------
laxmi vikhroli
8. The medicine name “crosin” has been scrapped and a new name has been
assigned to it, “aspirin”. Make the changes accourdingly.
SQL> update medicine
2 set med_name='aspirin' where med_name='crosin';
1 row updated.
MED_NO MED_NAME
---------- --------------------
1 brufen
2 aspirin
3 mox
4 ciplox
5 disprin
NAME ID
-------------------- ----------
samir 2
viral 5
10. Give the payable amount along with receipt number of the recent order
made by Vishnu medical store.
PAY_AMT RECIEPT_NO
---------------- ------------------
3000 ar001