LEFT JOIN keeps rows with nothing to connect to
LEFT JOIN keeps every row from the first table, even with no match, and fills the missing columns with NULL. A plain JOIN would drop those unmatched rows. Swapping the table order changes which side stays whole.
A tiny example
In plain English: Show me every customer’s name with their order, leaving the order blank for customers with none.
SELECT c.name, o.total
FROM customers c
LEFT JOIN orders o
ON o.customer_id = c.id;Query result
| name | total |
|---|---|
| Amara | 8.5 |
| Amara | 3.25 |
| Theo | 12 |
| Sana | NULL |
Amara has two orders, so she appears once for each. Sana matched no order, so she kept her row and her order total came back NULL.
See every JOIN type side by side in the SQL JOIN diagram & cheat sheet.
Common questions
- What happens when the second table has no match?
- The row from the first table is still returned, and every column from the second table comes back as NULL for that row.
- How is LEFT JOIN different from INNER JOIN?
- A plain (INNER) JOIN only returns rows with a match on both sides. LEFT JOIN returns those too, plus every unmatched row from the first table.
Related SQL lessons
Practice LEFT JOIN step by step
The Foundations Track has beginner puzzles built around this idea. Tap tiles, see real results. No terminal, no setup.
practice this in the courseReady for a break?
A fresh, bite-sized SQL puzzle waits every morning. Tap tiles, see real results. No terminal, no setup, no timers.
Try today's free SQL puzzle