Skip to content
BENIBIX Learn

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.

Development🗃️ Databases

Inner Join

A join that keeps only the rows with a match in both tables.

An inner join returns only the rows that have a match in both tables. A customer with no orders does not appear, and neither does an order with no customer. It is the default kind of join, so a plain JOIN means INNER JOIN. Use it when you only care about things that are linked. It is the most common join by far.

Example
Jack lists customers who have bought something. Lucy has no orders yet, so the inner join leaves her out.
Why it matters
Most questions are about things that are linked. An inner join gives exactly those.
Full entry
Development🗃️ Databases

Left Join

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

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.
Why it matters
Finding what is missing is a common need. A left join is how you see it.
Full entry

In one line

Inner Join
A join that keeps only the rows with a match in both tables.
Left Join
A join that keeps each row from the first table, with a match or not.