CROSS JOIN pairs every row of A with every row of B — no condition. See why accidental cross joins explode row counts.
Join type
Data (click a cell to edit)
SELECT * FROM A CROSS JOIN B
ON A.key = B.key — empty keys are treated as SQL NULL and never match
Table A
Table B
Result
| A.key | A.val | B.key | B.val |
|---|---|---|---|
| 1 | kim | 1 | dev |
| 1 | kim | 3 | hr |
| 1 | kim | 4 | fin |
| 2 | lee | 1 | dev |
| 2 | lee | 3 | hr |
| 2 | lee | 4 | fin |
| 3 | park | 1 | dev |
| 3 | park | 3 | hr |
| 3 | park | 4 | fin |
Edit a key or add a row — the connector lines and result update instantly. The 'Duplicate key' preset shows why LEFT JOIN row counts can grow.
CROSS JOIN produces every combination: A × B rows, no condition. Five rows times a hundred rows is five hundred result rows.
Legitimate uses are 'generate all combinations' — date × product grids that fill empty cells with zero sales, or color × size SKU matrices.
The danger is the accidental one: `FROM A, B` without a join condition is a cross join in disguise, and it's how production queries suddenly return hundreds of thousands of rows. SQL JOIN Visualizer