Boss: model a library
Model a small library from six rules. Create members(member_id, email), books(isbn, title), copies(copy_id, isbn) and loans(loan_id, member_id, copy_id, lent_on, due_on, returned_on). Rules: isbn identifies a book; a copy belongs to one book; member emails are unique ignoring case; a loan is due after it starts; a copy has at most one unreturned loan; a member with loans cannot be deleted.
task
Rules: (1) books are identified by isbn, with a title; (2) a copy belongs to one book; (3) members have a case-insensitively unique email; (4) a loan links a member and a copy and is due after it starts; (5) a copy has at most one unreturned loan; (6) a member with loans cannot be deleted. Create members(member_id, email), books(isbn, title), copies(copy_id, isbn), loans(loan_id, member_id, copy_id, lent_on, due_on, returned_on). Eight hidden inserts must pass or fail as the rules say.