The following questions will all use the schema we're about to describe for a library database.
Books (isbn, title, author, genre, publisher)
Members (id, name)
Lending (isbn, id, checkout, returned) // checkout and returned are both DATETIME
A tuple in Books represents a single book in the library system (We're assuming the library doesn't have multiple copies of a book, and each book has a single author and publisher).
The Members table holds identifying information for people checking out books from the library. There may be multiple people with the same name and different member ids.
Lastly, the Lending table shows a history of books loaned to various members. The checkout and returned attributes are the timestamps the book was checked out to a user and subsequently returned by that user. Any Lending tuple with a NULL "returned" attribute means the book is currently checked out. Each unique checkout becomes a new tuple with the new checkout time.
Books.isbn is the primary key for Books. Members.id is the primary key for Members. Lending.isbn, Lending.id, and Lending.checkout together constitute the primary key for Lending. Lending.isbn is a foreign key to Books.isbn. Lending.id is a foreign key to Members.id.
For all queries below, you do not need sub-queries (but you may use them if you choose.)