Skip to main content
Albero Academy

FULL & CROSS JOIN

Keep everything, or combine every pair of rows.

Joins & Combining7 min

Two less-common but useful joins. A FULL OUTER JOIN keeps unmatched rows from both sides; a CROSS JOIN pairs every row of one table with every row of the other.

FULL OUTER JOIN

keep everything
SELECT s.name, p.name AS programme
FROM students s
FULL OUTER JOIN programmes p ON s.programme_id = p.id;
-- unmatched students AND unmatched programmes both appear (with NULLs)

CROSS JOIN

every combination
SELECT s.size, c.colour
FROM sizes s
CROSS JOIN colours c; -- every size × every colour (a Cartesian product)

Key takeaways

  1. 01FULL OUTER JOIN keeps unmatched rows from both tables (NULLs on the missing side).
  2. 02CROSS JOIN pairs every row with every row — a Cartesian product.
  3. 03A CROSS JOIN produces rows×rows results — use deliberately.
  4. 04Forgetting ON causes an accidental cross join; not all DBs support FULL OUTER JOIN.

Finished this chapter?

Mark it complete to track your progress through SQL.