Library database SQL: unreturned copies, top books and referral gaps

0
Remix

A library schema has tables for books, copies, members, checkouts, reservations and authors. Write the queries:

  1. How many copies are in good condition and not yet returned? Among them, what share were renewed more than twice?
  2. Among books with more than ten copies, return the three with the longest total time on loan (return date minus checkout date, summed over their lifetime).
  3. Members can refer other members. Find the member with the largest difference in reserved books between them and the member who referred them, and that difference.

A data engineering screen: about 25 minutes of SQL like this, then Python, with only a few minutes per question.

MetaTechnical phone screenLast asked Nov 2025
No answer yet. Write the first one; the best answer gets endorsed.