join

Combining rows from two tables into one result by pairing rows according to a rule, usually matching keys.

In more detail

JOIN names the second table and ON states the pairing rule, typically that a foreign key equals a primary key. The result has one row per matching pair, so a customer with two orders appears twice. Normalisation splits data into tables; joins put it back together.

Examples

Joins are the usual cure for the N+1 query problem.
Correlation rules are joins: each successful login joined to the failed logins from the same address in the ten minutes before it, then grouped and counted.
FROM orders JOIN customers ON customers.id = orders.customer_id

Related terms

Taught in

References