PostgreSQL

PostgreSQL Joins

Combine related rows from two or more tables.

Why use joins?

A join connects tables through a related key, such as products.category_id and categories.id. The join type determines which unmatched rows remain.

SELECT p.name, c.name AS category
FROM products AS p
JOIN categories AS c ON c.id = p.category_id;

Use explicit join conditions so relationships are clear and accidental Cartesian products are avoided.

Further Reading

Continue learning with these related tutorials:

Continue learning