#1 Data Analytics Program in India
₹2,499₹1,499Enroll Now
Step 9
4 min read

Cross Join

Combine every row with every row - all combinations!

What is Cross Join?

Cross Join combines EVERY row from first table with EVERY row from second table.

Simple rule: 3 colors × 2 sizes = 6 combinations

How Cross Join Works

Basic Syntax

SELECT * FROM table1 CROSS JOIN table2;

Example: All Color-Size Combinations

SELECT colors.name, sizes.name FROM colors CROSS JOIN sizes;

Result: 4 rows (2 colors × 2 sizes)

Warning!

Cross Join creates many rows fast!

  • 10 × 10 = 100 rows
  • 100 × 100 = 10,000 rows
  • 1000 × 1000 = 1,000,000 rows!

When to Use

  • Generate all product variants (color + size)
  • Create date ranges
  • Test data combinations

Try It Below

Practice with color-size combinations!

Congratulations!

You completed all JOIN types! 🎉

Finished this topic?

Mark it complete to track your progress and maintain your streak!