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
Step: 1
Here are the SQL queries to accomplish the tasks a Retrieve all books published in the year 2020 SEL...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started