Lesson 6: INNER JOIN

07 Jul 2026 1 min Swarnil Singhai

INNER JOIN combines rows from two tables where a matching key exists in both — the most common way to bring related data together.

Real-time example

Show each order alongside the customer's name, not just their customer_id number.

SELECT o.id, c.name, o.amount
FROM orders o
INNER JOIN customers c ON o.customer_id = c.id
WHERE o.amount > 1000;

What's happening

Only orders with a matching customer row appear — an order with a broken/missing customer_id is silently excluded by INNER JOIN.

Alias tables (o, c) once you're joining more than one — it keeps every column reference unambiguous and readable.

Advertisement