On this page
  1. JOIN
  2. Syntax & Overview
  3. Notes & Best Practices
  4. Example

JOIN

Prev: `FROM` | Up: clauses | Next: `LEFT JOIN`
Rel: clauses, SQL Query Execution Lifecycle
Ref: PostgreSQL — SQL Commands
Tags: #public #databases #sql #clauses #tier/core


Syntax & Overview

FROM users u INNER JOIN orders o ON o.user_id = u.id

Combines matching rows from two tables (INNER JOIN is default).

Notes & Best Practices

Example

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

Linked from

Related notes