List the titles of books that have at least one review, using EXISTS.
List the titles of books that have at least one review, using EXISTS.
Answer
SELECT title FROM books b WHERE EXISTS ( SELECT 1 FROM reviews r WHERE r.book_id = b.id );
List the titles of books that have at least one review, using EXISTS.
List the titles of books that have at least one review, using EXISTS.
Answer
SELECT title FROM books b WHERE EXISTS ( SELECT 1 FROM reviews r WHERE r.book_id = b.id );