← Questions

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

0
MetaCodingLast asked Nov 2025

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.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding