Skip to main content

What does CROSS JOIN do?

CROSS JOIN produces a cartesian product of two tables - that is, every row from the first table gets paired with every row from the second.

It doesn't need an ON condition. The number of result rows = the row count of the first table × the row count of the second.

Example

sql
SELECT * FROM colors CROSS JOIN sizes;

If colors has 3 rows and sizes has 4, the result is 12 rows (3 × 4).

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.