DELAPARRA
Index
Color
NL
Category: SQL

INNER JOIN

Explained by Updated

What is INNER JOIN?

INNER JOIN: Returns only rows that match in BOTH tables. The default — JOIN with no qualifier means INNER JOIN. An INNER JOIN returns only rows that have a match in both tables. SELECT ... FROM users JOIN orders ON orders.user_id = users.id returns users who have orders, combined with those orders. Users without orders are left out.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about INNER JOIN

How is INNER JOIN used in practice?

JOIN without a qualifier means inner join. It is the most common join in everyday queries.

What should you keep in mind with INNER JOIN?

Be aware of what it filters out. If you want to list all customers with their order count, including those with zero orders, an inner join silently drops the zeros. Use a LEFT JOIN for that. Also check the join condition carefully. A missing or wrong ON clause can multiply rows and inflate totals without any error message, which is a classic source of wrong numbers in reports.

What does an example of INNER JOIN look like?

SELECT u.name, o.total FROM users u JOIN orders o ON o.user_id = u.id;

At a glance

CategorySQL
Explained by
Updated

More SQL terms

All terms starting with I

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.