Exercise 2 Dbms
Exercise 2 Dbms
A) a) select product_no,description from product_master notin(select product_no from sales_order_details); where product_no
b) select name,address1,address2,city,state,pincode from client_master where client_no in(select client_no from sales_order where order_no=1900); c) select client_no,name from client_master where client_no in(select client_no from sales_order where to_char(order_date,mon-yy)<may,96); d) select client_no,name from client_master where client_no in(select client_no from sales_order where order_no in(select order_no from sales_order_details where product_no in(select product_no from product_master where description=1.55 Drive))); e) select name from client_master where client_no in(select client_no from sales_order where order_no in(select order_no from sales_order_details where(qty_ordered*product_rate)>=1000));
EXERCISE 5
Queries on Library Table
a)select avg (IT_book_price),IT_book_title,IT_book_author,from where IT_book_price>avg(IT_book_price); IT_book
b) select max(IT_book_price),IT_stud_name from IT_book,IT_stud,IT_issu_retu where IT_book.IT_book_code=IT_issu_retu.IT_book_code and IT_stud.IT_stud_code=IT_issu_retu.IT_stud_code and IT_book_price=max(IT_book_price); c) select max(IT_book_price),IT_stud_name from IT_stud,IT_book,IT_issu_retu where IT_book.IT_book_code=IT_issu_retu.IT_book_code and IT_stud.IT_stud_code=IT_issu_retu.IT_stud_code group by IT_stud_branch having IT_stud_branch=EC; d) select max(IT_book_price),IT_stud_name from IT_stud,IT_book,IT_issu_retu where IT_book.IT_book_code=IT_issu_retu.IT_book_code and IT_stud.IT_stud_code=IT_issu_retu.IT_stud_code group by IT_stud_branch; e) select IT_book_author,IT_book_name,min(IT_book_price) from IT_book group by IT_book_author; f) select max(IT_book_price),IT_stud_name from IT_stud,IT_book,IT_issu_retu where IT_book.IT_book_code=IT_issu_retu.IT_book_code and IT_stud.IT_stud_code=IT_issu_retu.IT_stud_code group by IT_book_publish having IT_stud_branch =IT;
EXERCISE 7
Queries on VIEWS a)create view a_student as select IT_stud_name,IT_stud_card_no.IT_issu_doi.IT_issu_fine from IT_stud,IT_issu_retu where IT_stud.IT_stud_code=IT_issu_retu.IT_stud_code; b) create view a_details as(select * from IT_stud,IT_issu_retu where IT_stud.IT_stud_code=IT_issu_retu.IT_stud_code and IT_stud_branch=IT); c) select IT_issu_fine from a_details; g) create view CS_details as (select * from IT_stud,IT_issu_retu where IT_stud.IT_stud_code=IT_issu_retu.IT_stud_code and IT_stud_branch=CS); create view EC_details as( select * from IT_stud,IT_issu_retu where IT_stud.IT_stud_code =IT_issu_retu.IT_stud_code and IT_stud_branch=EC); h) create view CS_EC as select * from IT_stud ,IT_issu_retu where IT_stud.IT_stud_code=IT_issu.IT_stud_code and IT_stud_branch=EC or CS and IT_stud_name=gaurav;