Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You are working with a database that holds information about a library system. The database includes two tables: Books and Loans. The Books table lists
You are working with a database that holds information about a library system. The database includes two tables: Books and Loans. The Books table lists every book available in the library, and the Loans table records details about the books currently borrowed by patrons:
Books BookID Title, Author, ISBN, PublicationYear
Loans LoanID BookID, PatronID, LoanDate, DueDate, ReturnedDate
Task: Write a SQL query to find all books that have been loaned out at least once this year but are not currently on loan ie no NULL values on the ReturnedDate column Your result should include the ISBN, Title, Author, and the most recent LoanDate for these books. Your solution MUST use the semijoin operator.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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