Hereโs another join type to your collection: FULL OUTER JOIN
.
FULL OUTER JOIN
returns both rows from the left and right table (if the record from one table has no matched record from the other table all columns will have NULL
value).
I havenโt used FULL OUTER JOIN
for a long time (read never) and itโs another one of those interview questions.
Hereโs an example query that joins library entries and users:
SELECT * FROM books_users b FULL OUTER JOIN users u ON b.user_id = u.id
Run query
IMO everything could be done via INNER
and LEFT
joins. Itโs better to...