Consider a sample database schema representing a library management system with the following tables: Books: book_id (Primary
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 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.
Accounting Information Systems
ISBN: 978-0133428537
13th edition
Authors: Marshall B. Romney, Paul J. Steinbart