Sobes.tech
Senior

Write an SQL query: select the titles of all books with more than three authors.

sobes.tech AI

Answer from AI

sql SELECT b.title FROM books b JOIN book_authors ba ON b.id = ba.book_id GROUP BY b.id, b.title HAVING COUNT(ba.author_id) > 3;


Here:
- `books` — table with books (column `title` — book title, `id` — unique book identifier).
- `book_authors` — table of book-author relationships (`book_id` and `author_id`).

The query selects the titles of books that have more than three associated authors.