Joins

Learn SQL joins with practical examples and guided drills on dbSyntax.

Start with Joins Intro

Joins Intro

Beginner

This subsection gives you a practical foundation before detailed join syntax. Goal: understand what joins do, which join to pick, and how to...

INNER JOIN

Beginner

INNER JOIN keeps rows where the join key matches in both tables. If a row has no partner on the other side, it is dropped, from both sides. ...

LEFT JOIN

Beginner

LEFT JOIN keeps every row from the left table, even when no match exists on the right. Unmatched right-side columns come back as NULL. This ...

RIGHT JOIN

Beginner

RIGHT JOIN keeps every row from the right table and fills left-side columns with NULL when there's no match. It's the mirror image of LEFT J...

FULL OUTER JOIN

Beginner

FULL OUTER JOIN keeps every row from both tables. Where there's a match on the join key, columns from both sides come through. Where there i...

CROSS JOIN

Beginner

CROSS JOIN returns every combination of rows from two tables: the Cartesian product. No ON clause, no matching key. If table A has n rows an...

Self Join

Beginner

A self join is any join where both sides are the same table. You use it to relate rows within a single entity: employees to their managers, ...

Join Debugging: Duplicates & Missing Rows

Beginner

Almost every join bug in production shows up as one of two symptoms: 1. The row count ballooned. Your SUM is suddenly double, your COUNT is ...

UNION vs UNION ALL

Beginner

Every join in this section combined tables side-by-side: each output row got wider as columns from both tables lined up on a key. Set operat...