~/ learn/ postgresql/ cards/ EXISTS and correlated subqueries
1 of 2

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 );

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/84e98985-67c4-4e04-b96f-f45e0246769d/flashcard utf-8 LF