0PricingLogin
SQL Academy · Lesson

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;

All lessons in this course

  1. Why Joins (Relational Model Recap)
  2. INNER JOIN Mechanics
  3. LEFT/RIGHT JOIN and OUTER Joins
  4. Self-Joins and Aliases
← Back to SQL Academy