Rows that match in both tables
An INNER JOIN returns one row for every pair of rows from the two tables where the join predicate is true. Rows in either table without a match are dropped from the result.
The shape:
SELECT cols FROM A INNER JOIN B ON A.x = B.x;JOIN alone means INNER JOIN — the keyword is optional but writing it explicitly makes intent obvious to the next reader.
Tip: Always alias your tables (
FROM authors a INNER JOIN posts p) and qualify column names. Unaliased queries with two columns named id are unreadable and silently ambiguous.