SQL joins

SQL JOIN examples explained

JOINs are among the most important SQL patterns for combining related records from different tables. This guide covers the main join types with clear examples.

Key JOIN patterns

INNER JOIN

Returns only rows that match in both tables, which is the most common relational query pattern.

LEFT JOIN

Returns all rows from the left table and matching rows from the right table, keeping unmatched left rows visible.

RIGHT JOIN

Keeps all rows from the right table and matches those from the left side where possible.

FULL OUTER JOIN

Returns rows from both tables, including unmatched rows from either side.

CROSS JOIN

Combines every row from one table with every row from the other table.

SELF JOIN

Joins a table to itself to compare related rows within the same dataset.

Get the full guideBrowse more examples

Ready to learn SQL with real examples?

Learn SQL step by step with practical examples, queries, and interview-focused problem solving.

Get the eBook