# Left Join

> A join that keeps each row from the first table, with a match or not.

**Field:** Software Development  
**Category:** Databases  
**Also known as:** LEFT JOIN, Left Outer Join

## Think of it like

Think of it like a class photo. All the kids are in it, even if their mum did not come.

## Definition

A left join returns every row from the first table, plus any matches from the second. Where there is no match, the second table's columns come back as NULL. So a customer with no orders still appears, with an empty total. Use it when you want to see what is missing as well as what is there. It is also called a left outer join.

## Example

Lucy wants to email people who have never ordered. A left join shows all customers, and the empty totals are her list.

## Example code

```sql
SELECT customers.name, orders.total
FROM customers
LEFT JOIN orders ON orders.customer_id = customers.id;
-- Emma | 25.0
-- Emma | 40.0
-- Jack | 15.5
-- Lucy | NULL
```

Lucy stays in the result, with NULL where an order would be.

## Why it matters

Finding what is missing is a common need. A left join is how you see it.

## Common mistake

Filtering the second table in WHERE. That throws away the NULL rows and turns it back into an inner join.

## Three principles

- **Keep the left side.** Every row from the first table.
- **NULL for no match.** Empty columns show the gap.
- **Find what is missing.** Great for gaps in data.

## Related terms

- [SQL Join](https://learn.benibix.com/term/development/join)
- [Inner Join](https://learn.benibix.com/term/development/inner-join)
- [Null](https://learn.benibix.com/term/development/null)
- [Database Query](https://learn.benibix.com/term/development/query)

## Told apart from

- [Inner Join vs Left Join](https://learn.benibix.com/compare/inner-join-vs-left-join): An inner join keeps only rows that match in both tables. A left join keeps every row from the first table, and fills the gaps with NULL.

---

Source: https://learn.benibix.com/term/development/left-join
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
