Inner Join
An INNER JOIN returns only the rows where there is a match in both tables being joined - it's the most commonly used join type, and the default when you write JOIN without specifying a type.
Basic Syntax
SELECT c.first_name, o.amount
FROM customers c
INNER JOIN orders o ON c.customer_id = o.customer_id;
This returns only customers who have placed at least one order - customers with no orders, and orders with no matching customer, are excluded from the result.
Joining Multiple Tables
SELECT c.first_name, o.order_id, p.product_name
FROM customers c
INNER JOIN orders o ON c.customer_id = o.customer_id
INNER JOIN order_items oi ON o.order_id = oi.order_id
INNER JOIN products p ON oi.product_id = p.product_id;
When to Use an Inner Join
Use an inner join when you only care about records that have a confirmed relationship on both sides - for example, only showing customers who have actually placed orders.
If you're missing rows you expected to see in your results, check whether an INNER JOIN is silently excluding unmatched rows - a LEFT JOIN might be what you actually need.