What is Inner Join?

An inner join combines rows from two tables and keeps only the rows that have a match in both.

Inner Join explained

You say which columns should match, usually a foreign key against a primary key, and the database returns one row for each matching pair. Rows with no partner on the other side are dropped.

That makes it the right join when you only want records that exist in both places, and the wrong one when missing partners matter: customers with no orders vanish from an inner join between customers and orders.

Example

Joining orders to customers on customer_id returns each order with its customer's name; orders with a missing customer are not returned.

How it differs from similar terms

A left join keeps every row from the left table, with nulls where there is no match.

Frequently asked questions

What is Inner Join?
An inner join combines rows from two tables and keeps only the rows that have a match in both.
Can you give an example of Inner Join?
Joining orders to customers on customer_id returns each order with its customer's name; orders with a missing customer are not returned.
How is Inner Join different from similar terms?
A left join keeps every row from the left table, with nulls where there is no match.