Consider a “Library Management System” which keeps the following tables: Book (isbn-no, book-title, author, publisher, edition, year-of-copyright) BookAccession (accession-no, isbn-no, date-of-purchase) Members (m-id, m-name, m-address, m-phone). Issue-return (accession-no, m-id, expected-date-of-return, actual-date-of-return) 7 Please note that a member can be issued a book for a period of 15 days. The actual-date-of-return is kept blank for the books that have not been returned. Write and run the following SQL queries on the tables:
(i) Find the m-id and m-name of the members who have got maximum number of un-returned books
(ii) List the book details along with the number of copies for that book in the library (issued or notissued both)
(iii) Find the names of all those students who have got all the books issued to him of the author named “ABC” .
(iv) Find the books that are expected to be returned in this week.
(v) Find those members who have not got any book issued to him/her during last six months.
(i) To find the m-id and m-name of the members who have got the maximum number of un-returned books, we can use the following SQL query:
SELECT i.m-id, m.m-name, COUNT(*) AS num_unreturned_books
FROM Issue_return i
INNER JOIN Members m ON i.m-id = m.m-id
WHERE i.actual-date-of-return IS NULL
GROUP BY i.m-id, m.m-name
HAVING COUNT(*) = (SELECT MAX(num_unreturned_books_count) FROM (SELECT COUNT(*) AS num_unreturned_books_count FROM Issue_return WHERE actual-date-of-return IS NULL GROUP BY m-id) AS unreturned_books_counts)
This query first joins the Issue_return and Members tables based on the m-id column. It then filters the rows where the actual-date-of-return column is ___ _______ ________ ______ __________.
_________ _________ _________ _______ ________ _____ _________ __________.
_____ ___ ____ __________ __________ ________ ______ ___.
___ _______ _____ ________ ______.
__________ __________ ______ ___ __________ ____ ________ ______ _____ _____ __________ __________.
____ _____ __________ _________ ______ _______ ________ _________.
_________ ________ ______ ______ ______.
____ _________ _________ ________ _________ ____.
_______ _______ _______ ______ _________ ___ _______ ______ ____.
________ ____ ________ ______ _______ ________.
___ _________ __________ ___ _________ _____ _________ _______ ____ ___ _____ __________.
________ _______ ____ _________ ______ ___ _________ _____ _________ _____ ______ ____.
______ ____ _____ __________ ______.
_______ _____ _____ _____ ____ ____ _____.
_________ ___ ____ ______ ____ ____ ________ ________.
______ __________ ___ ____ ________ __________ ___.
_________ _____ ___ ___ _______ ________ ______ _________ _______ __________ ________.
____ _______ ______ ___ ________ _________ __________ ___ _____ ____ _______ __________.
_______ _____ _________ ______ __________.
_______ ________ ________ _______ ________ _______.
________ ____ ______ ___ ____ ___.
______ _________ _______ _____ ______ _________ __________ _________ ______ ___ __________ _____.
_______ ____ _______ ____ _________ _________ _________ _________ _______ __________ ____.
_____ ___ _____ _____ _________ __________ __________.
___ _________ ______ _______ _______ __________ ___ ______ __________.
____ __________ ____ ________ ________ _______ _____ ______ ______ _____ __________.
________ __________ ___ __________ ________ _________ ______.
______ __________ ____ ________ _______ _____ _________ _______ ________ ________ ________ _______.
_______ __________ _________ _______ ____ _____ ______ ______ _______ __________ _______.
_________ _________ _________ __________ ___ ____ _____ ____.
___ _________ _________ __________ _________.
______ ______ ____ __________ _______ __________ ____.
____ _______ ________ __________ ___ _____ ______.
________ ________ ____ ___ ______.
___ ___ _______ _______ _______ ______ _________ ________ ______.
___ _______ _________ _________ _______ ________ _______ ________ ______ __________.
_________ _________ ____ ______ _________ _____ __________.
_____ ____ _________ ____ ______ ______ _______ _______ ______ _______ _____.
__________ _______ __________ _____ __________ ______ _____ ________ ___ _________.
_________ ______ ___ ________ ____ _______ ________ _______.
________ ___ __________ ___ ______.
______ ___ _________ _______ ________ _________ ____ ______ ______ __________.
________ _________ ____ ________ _____ ____ _________ ___ _______ ____ ______ ____.
________ ______ __________ _________ ________ _________ __________ _______ ______ ________ ____.
_____ _________ _______ __________ ___ __________ __________.
_______ ___ _____ ____ _________ _________ ____ ________.
_______ __________ ____ _______ __________ ________.
_____ ________ ___ __________ ________ _____ ___ __________ ______.
_______ ______ _____ ____ __________ ___ __________ ______ ________ ___ ______ _______.
__________ _______ _______ ____ _________ ______.
___ ________ _______ ________ ________.
___ ________ ___ ________ _______.
________ ___ ____ ___ ______ ___.
______ __________ ______ _______ ____ ___ _______ __________ __________ _________ ________ ___.
___ _________ ________ _____ _____ __________ ___.
_________ _________ ___ _______ ________ ________ _______.
__________ ________ ______ ___ ___.
____ ____ ________ _________ ____ __________ ___.
________ ____ _______ ___ ______ ________ ___ __________ ____.
______ ________ ___ _______ ________.
_______ _____ ____ _______ ________ _____ ____ _____ _______ ______ ____.
_________ __________ _________ ______ ______.
__________ _________ __________ _____ ______ _______ _____ _______ ____ __________ _________.
_____ ____ ___ _____ ____ _________ ____ _______ ___ ___ _________.
______ __________ _____.
Get Full Answer on WhatsApp