Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing
Back
  1. Home
  2. Interview prep
  3. What is CROSS JOIN?

SQL · Basics & Joins

What is CROSS JOIN?

Easysql-06
cross joincartesian product

Question

What is CROSS JOIN?

Solution

A CROSS JOIN creates every possible combination of rows.

If:

  • Table A = 100 rows
  • Table B = 50 rows

Result:

100 × 50 = 5,000 rows

Example:

SELECT *
FROM products
CROSS JOIN colors;

If there are 100 products and 5 colors, you get 500 combinations.

Use cases:

  • Generating combinations
  • Calendar/date combinations
  • Test data
  • Product/option combinations

Watch out: CROSS JOIN can explode into a huge result.

🎯 Put this concept into practice

Solidify this answer with real hands-on interview drills in the browser studio.

Open related drill →
PreviousNext