🗃️Inner Join
Also known as INNER JOIN
A join that keeps only the rows with a match in both tables.
Think of it like
Think of it like a dance where only pairs get on the floor. Anyone without a partner sits out.
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.
Definition
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.5Common mistake
Key takeaways
- 1Matches only. Both sides must have a row.
- 2The default. Plain JOIN means inner.
- 3Silent drops. Rows with no match just vanish.