E
E
III. Design an ER model for the library database. Define the relationships based on
the given
schema.
BOOK (Book_id, Title, Publisher_Name, Pub_Year) BOOK_AUTHORS (Book_id,
Author_Name)
PUBLISHER (Name, Address, Phone)
BOOK_COPIES (Book_id, Branch_id, No-of_Copies)
BOOK_LENDING (Book_id, Branch_id, Card_No, Date_Out, Due_Date)
LIBRARY_BRANCH (Branch_id, Branch_Name, Address)
Create tables based on the above schema, add constraints(PRIMARY KEY, FOREIGN KEY)
and
insert relevant data.
Write SQL queries to
a. Retrieve details of all books in the library - id, title, name of publisher,
authors,
number of copies in each branch, etc.
b. Get the particulars of borrowers who have borrowed more than 3 books, but from
Jan 2021 to Jun
2021
d. Retrieve all books published by an author.
e. Delete a book in the BOOK table. Update the contents of other tables to reflect
this data
manipulation operation. (Use trigger to update the contents of other tables)
f. Create a view of all books and the number of copies that are currently available
in the Library.
IV. Design an ER model for the college database. Define the relationships based on
the given
schema.
STUDENT (USN, SName, Address, Phone, Gender)
SEMSEC (SSID, Sem, Sec)
CLASS (USN, SSID)
SUBJECT (Subcode, Title, Sem, Credits)
IAMARKS (USN, Subcode, SSID, Test1, Test2, Test3, FinalIA)
Create tables based on the above schema, add constraints(PRIMARY KEY, FOREIGN KEY)
and
insert relevant data. Write SQL queries to
a. List all the student details studying in the fourth semester 'C' section.
b. Compute the total number of male and female students in each semester and in
each section.
c. Display semwise student details along with semester and section in ascending
order.
d. Create a view of Test1 marks of students for the given USN in all subjects.
e. Create a procedure to calculate the Final IA (average of 3 internals) of the
given USN and subject
and print the Final IA using out parameter.