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:
Books:
- book_id (Primary Key)
- title
- author
- genre
- publication_year
Members:
- member_id (Primary Key)
- name
- registration_date
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
Here are the SQL queries to accomplish the tasks a Retrieve all books published in the year 2020 SEL... View full answer
Get step-by-step solutions from verified subject matter experts
