Question: I need help with this assignment. Use this database schema, primary keys are in bold: Book( bookID , ISBN, title, author, publish-year, category) Member( memberID

I need help with this assignment.

Use this database schema, primary keys are in bold:

Book(bookID, ISBN, title, author, publish-year, category)

Member(memberID, lastname, firstname, address, phone-number, limit)

CurrentLoan(memberID, bookID, loan-date, due-date)

History(memberID, bookID, loan-date, return-date)

Members can borrow books from the library. The number of books they can borrow is limited by the limit field of the Member relation (it may differ for different members). The category of a book includes fiction, non-fiction, childrens and reference. The CurrentLoan table represents the information about books that are currently checked out. When the book is returned to the library, the record will be removed from CurrentLoad relation, and will be inserted into History relation with the return-date. A library may have more than one copy of the same book, in which case each copy has its own bookID, but all copies share the same ISBN.

Write SQL statements for each of the following questions.

(1)(6 pts) For each member (using memberId, lastname and firstname), find the number of books currently checked out by the member.

(2)(7 pts) List the ISBN and title of the books with at least two copies.

(3)(7 pts) Create a view call member_book that includes memberID, lastname, firstname, bookID, and title, that shows which member has borrowed which book, including currently and in the past.

(4)(4 pts) Use the view created above in question (3) to find the bookID and title of all the books checked out by John Smith in the past or currently.

(5)(8 pts) Delete member David Jones and all the relevant records. Make sure you delete related tuples from all the relevant relations, and delete them in the right order.

(6)(8 pts) Increase the limit by 2 for all members, but the maximum limit is 10. Display the member ID and the limit for each member before and after you make the changes.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!