Question: Consider a sample database schema representing a library management system with the following tables: Books: book_id (Primary Key) title author genre publication_year Members: member_id (Primary

Consider a sample database schema representing a library management system with the following tables:

  1. Books:

    • book_id (Primary Key)
    • title
    • author
    • genre
    • publication_year
  2. Members:

    • member_id (Primary Key)
    • name
    • email
    • registration_date
  3. Borrowings:

    • borrowing_id (Primary Key)
    • book_id (Foreign Key)
    • member_id (Foreign Key)
    • borrow_date
    • return_date

Write SQL queries to accomplish the following tasks:

a) Retrieve all books published in the year 2020.

b) List the names and email addresses of members who registered after January 1, 2021.

c) Count the total number of borrowings made by each member, and display the member's name along with the count.

d) Find the titles of the books borrowed by a member with the name 'John Doe'.

e) Calculate the average number of days each book is borrowed before being returned, and display the title of the book along with the average borrowing duration.

f) List the names of members who have borrowed books but have not returned them yet.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Here are the SQL queries to accomplish the tasks a Retrieve all books published in the year 2020 SEL... View full answer

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!