Outer joins
Keeping the books with unknown authors (attempt 2)
Use a left outerjoin
select title, name
from book left join author using (author_id)
- left join: Keep all the rows of the left
table, book in this case.
- Compute the join as usual.
- But for book rows with NULL author_id: Fill in the other
columns with NULL.
|