Sobes.tech
Junior — Senior

Selection of unique book titles with more than three authors

livecode

Task condition

The database stores records about books, but titles may repeat. It is necessary to modify the SQL query so that it only outputs titles that occur once and are associated with more than three different authors.

SELECT Bk.name
FROM BooksAuthor AS BA2
JOIN Author AS Auth ON BA2.author_id = Auth.id
JOIN Book AS Bk ON BA2.book_id = Bk.id
GROUP BY Bk.name
HAVING COUNT(DISTINCT Auth.id) > 3;