JOIN

Applies to: sql

A JOIN combines rows from two tables by matching a related column. An INNER JOIN keeps only matching rows; a LEFT JOIN keeps all left-table rows (filling unmatched right columns with NULL). Joins are how relational data is recombined.

SELECT o.id, u.name
FROM   orders o
JOIN   users  u ON u.id = o.user_id;

See also: select