Find the books written by MILLER and NELSON.
1st attempt:
The query never ends.
2nd attempt:
Remove from FROM Clause Genres, Book_Genres, and Book_Authors
Add WHERE B.BOOK_ID=BA.BOOK_ID
AND A.AUTHOR_ID=BA.AUTHOR_ID
The query returns immediately, but shows duplicates. To remove the duplicates, we will try using DISTINCT or GROUP BY.
3rd attempt:
Add DISTINCT to the SELECT clause. It sorts 7 million records, it doesn’t remove duplicates, and it shows all books.
4th attempt:
Use GROUP BY. It is a bit faster & sorts fewer records, but still shows all the books.