INNER JOIN
ELI5 — The Vibe Check
INNER JOIN only returns rows where there is a match in BOTH tables. If a user has no orders, they do not appear in the result. It is the strictest JOIN — both sides must have a match for the row to show up.
Real Talk
INNER JOIN returns only the rows where the join condition is satisfied in both tables. Rows with no match in either table are excluded from the result set. Writing JOIN without specifying a type defaults to INNER JOIN in standard SQL.
Show Me The Code
-- Only orders that have a matching user
SELECT u.name, o.total
FROM orders o
INNER JOIN users u ON o.user_id = u.id;
When You'll Hear This
"Use INNER JOIN when you only want rows that exist in both tables." / "INNER JOIN is the default if you just write JOIN."
Related Terms
FULL JOIN
FULL JOIN returns everything from both tables regardless of whether there is a match. Rows with no match on either side get NULLs.
JOIN
JOIN combines rows from two tables based on a related column.
LEFT JOIN
LEFT JOIN returns all rows from the left table, and matching rows from the right table.
RIGHT JOIN
RIGHT JOIN is LEFT JOIN's mirror image — it returns all rows from the right table, and matching rows from the left.