Account
Categories

CROSS JOIN: Cartesian Product of Tables


It is an SQL operator that combines each row from the first table with every row from the second table.

It joins both tables without a join condition.

It follows the Cartesian Product principle.

Such as, if Table A (first table) has 'm' rows and Table B (second table) has 'n' rows, the result will contain m × n rows.

Note: CROSS JOIN is best suited for small databases.

Syntax:

SELECT columns
FROM table1
CROSS JOIN table2;