Beginner

637. CROSS JOIN Basics

Understand how CROSS JOIN creates combinations between every row of two tables.

📘 Lesson 637 of 728 ⏱ 13 min 🎯 Intermediate

A CROSS JOIN returns the Cartesian product of two tables, meaning every row from the first table is combined with every row from the second table.

CROSS JOIN is useful when every possible combination is required, but it can generate very large results.

Generate every combination of products and regions.

SQL
SELECT
    p.ProductName,
    r.RegionName
FROM Products p
CROSS JOIN Regions r;

Used in scenario planning, product-region matrices, scheduling, testing, and combination analysis.

  • CROSS JOIN has no matching condition.
  • Every row is combined with every other row.
  • Result size can grow very quickly.
  • Useful for generating combinations.
  • Use carefully with large tables.
What does CROSS JOIN return?

It returns every possible combination of rows from the two tables.

Why can CROSS JOIN be dangerous?

The result can become extremely large because the row counts are multiplied.

Have you finished this lesson?

Introduction to SQL – All Lessons