LEFT JOIN: keep rows without a match
Find members who never borrowed, customers who never ordered.
LEFT JOIN keeps every row of the first (left) table, even when nothing matches in the second. Where there is no match, the second table's columns are filled with NULL. That makes LEFT JOIN perfect for "who never…" questions: join, then keep rows where the right side IS NULL.
SELECT m.name, l.id
FROM members m
LEFT JOIN loans l ON l.member_id = m.id;Every member appears. Hana Sato shows up once with NULL as the loan id, because she has no loans.
The order of the tables matters: members LEFT JOIN loans keeps all members; loans LEFT JOIN members keeps all loans.
When counting with a LEFT JOIN, count a column from the right table, like COUNT(l.id). It skips the NULLs, so members with no loans get 0 instead of 1.