Sobes.tech
Junior — Senior

Designing the library schema and writing SQL queries

livecode

Task condition

It is necessary to design a data structure for a library, including three entities: Author, Book, and Reader.

  • Each instance of a book exists as a single entity and can only be held by one reader at a time. Create tables so that this restriction is reflected.
  • A book can have multiple authors (a many-to-many relationship).

Create the following SQL queries:

  1. Select the titles of all books that are currently with readers.
  2. Select the titles of all books in the collection that have more than three authors.
  3. Select the names of the three most frequently read authors at the moment.