Solution:-
Create a Database in 3NF & write queries for following.
• Display total quantity of each book
SQL>select sum(quantity),bname from Book,Publisher, Book_Publisher where Book.bno=Book_Publisher.bno and Publisher.pno=Book_Publisher.pno group by bname;
• Display Publisher names from 'Pune'.
SQL>select pname from Publisher where city='PUNE' order by pname;
• Display all publisher publishing more than two books.
SQL>select pname,bname,price from Book,Publisher, Book_Publisher where Book bno=Book_publisher.bno and Publisher.pno=Book_Publisher.pno group by pname,bname,price having count(Book bno)>2;
• Display publisher having average books price less than average books price of ‘BPV Publications’.
SQL>select avg(price)from Book,Publisher,Book_Publisher where Book.bno= Book_Publisher.bno and publisher.pno=Book_Publisher.pno and book.price<=(select avg(price)from Book,Publisher,Book_Publisher where Book.bno=Book_Publisher.bno and Publisher.pno=Book_Publisher.pno and pname='BPV');
SQL>select pname from Book,Publisher,Book_Publisher where Book.bno=Book_Publisher.bno and Publisher.pno=Book_Publisher.pno and pname='BPV' having avg
• Display publisher wise book details.
SQL> select pname,bname,price from Book,Publisher,Book_Publisher where Book.bno=Book_Publisher.bno and Publisher.pno=Book_Publisher.pno order by pname;.
/