LEFT JOIN keeps rows with nothing to connect to
A plain JOIN only returns rows that found a match on the other side, so a student in no club quietly disappears. LEFT JOIN keeps every row from the table named first and fills the other table's columns with NULL when there is no match. Because only the first table is protected, swapping the two tables changes the result.
A tiny example
In plain English: Show me every student's name with their club, and leave the club blank for students who are in none.
SELECT s.name, c.title
FROM students s
LEFT JOIN clubs c ON c.id = s.club_id;What comes back
| name | title |
|---|---|
| Amara | Chess |
| Theo | Drama |
| Sana | NULL |
Sana matched no club, so she kept her row and her club column came back NULL.
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