LEFT JOIN plus IS NULL finds rows with no match
To list the students who joined no club, keep everyone with a LEFT JOIN, then keep only the rows where the club columns came back NULL. A NULL there means that student matched no club at all. It reads oddly at first: you join two tables in order to find where nothing matched.
A tiny example
In plain English: Show me the students who are not in any club.
SELECT s.name
FROM students s
LEFT JOIN clubs c ON c.id = s.club_id
WHERE c.id IS NULL;What comes back
| name |
|---|
| Sana |
Sana is the only student whose club columns came back NULL — the only one in no club.
Related SQL lessons
Ready for a break?
Take on today's cozy puzzle. A fresh, bite-sized query waits every morning — no timers, no pressure.
play today's sip