Midterm SQL: 4
Give a SQL query that produces the set of pairs
(borrower, number) such that "number" is the number
of books borrowed by the "borrower" and that :
- Each book has never been borrowed by someone else
- The last name of the book's author is alphabetically after borrowers
Select card_number , count(book_ISBN)
From Library_patron, Borrowed, Book
Where card_number = borrowers_card_number and
author > last_name and book_ISBN = ISBN and
From Borrowed as borrower1, Borrowed as borrower2, book
Where book_ISBN = ISBN and
Borrower1.borowers_card_number <>borower2.borrowers_card_number)