INNER JOIN Mechanics
Understand INNER JOIN as a filtered Cartesian product, write join conditions, and read EXPLAIN output for joins.
The INNER JOIN
INNER JOIN returns only rows that have a matching pair in BOTH tables, based on the ON condition.
Basic INNER JOIN
Pull each order with its user:
SELECT o.id, o.total, u.email
FROM orders o
INNER JOIN users u ON u.id = o.user_id;
-- INNER is the default — you can also write:
SELECT o.id, o.total, u.email
FROM orders o
JOIN users u ON u.id = o.user_id;