INNER JOIN

Combines rows from two sources based on a join condition. INNER JOIN returns only the rows where the join condition is satisfied in both tables.

Syntax

INNER JOIN source ON joinCondition USING ( column(s) )

The INNER JOIN clause is used in SELECT statements:

SELECT columns
FROM table1 INNER JOIN table2
ON table1.column = table2.column

The JOIN keyword can be used as a shorthand for INNER JOIN:

Parameters

source

The table or subquery to join with.

ON joinCondition

A boolean expression that specifies the join condition. Only rows where this condition evaluates to true are included in the result.

USING (column(s))

A comma-separated list of column names that exist in both tables. This is shorthand for joining on equality of these columns. The USING clause automatically removes duplicate columns from the result set.

Returns

Returns a result set containing rows where the join condition is satisfied. For each matching pair of rows from the two sources, a combined row is produced with columns from both tables.

For more details see Joins.

See Also

  • SELECT - SELECT statement syntax

  • WHERE - WHERE clause filtering

  • ../../Subqueries - Subqueries and correlated subqueries

  • WITH - Common Table Expressions