~/ learn/ postgresql/ cards/ LEFT JOIN: keeping unmatched rows
1 of 2

Show every author's name and the title of each of their books, INCLUDING authors with no books in stock list (use a LEFT JOIN from authors). Columns: name, title.

Show every author's name and the title of each of their books, INCLUDING authors with no books in stock list (use a LEFT JOIN from authors). Columns: name, title.

Answer

SELECT a.name, b.title FROM authors a LEFT JOIN books b ON b.author_id = a.id;

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/3c397614-a11c-4455-bb83-30c3bb83d27e/flashcard utf-8 LF