# Inner Join

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

**Field:** Software Development  
**Category:** Databases  
**Also known as:** INNER JOIN

## Think of it like

Think of it like a dance where only pairs get on the floor. Anyone without a partner sits out.

## Definition

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.

## Example code

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

Lucy has no orders, so she is not in the result.

## Why it matters

Most questions are about things that are linked. An inner join gives exactly those.

## Common mistake

Using an inner join when you need the rows with no match too. They vanish without any warning.

## Three principles

- **Matches only.** Both sides must have a row.
- **The default.** Plain JOIN means inner.
- **Silent drops.** Rows with no match just vanish.

## Related terms

- [SQL Join](https://learn.benibix.com/term/development/join)
- [Left Join](https://learn.benibix.com/term/development/left-join)
- [Database Query](https://learn.benibix.com/term/development/query)
- [Structured Query Language (SQL)](https://learn.benibix.com/term/development/sql)

## 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/inner-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.
