Published Oct 6, 2023
Contribute to Docs

The CROSS JOIN command returns a table with all possible combinations of every row from the first table and every row from the second table.

This is also called a Cartesian join since it returns the Cartesian product of each row selected in the join.

This can produce extremely large data sets and can be modified to function more like an INNER JOIN by using a WHERE clause.


SELECT column(s)
FROM first_table
CROSS JOIN second_table;

Select one or more columns from first_table and second_table to return a table with the Cartesian product of these rows.


This example selects Styles from the Furniture table and Name from the Colors table. It uses a CROSS JOIN to return a table with combinations of each furniture style and color.

SELECT Furniture.Style, Colors.Name
FROM Furniture

All contributors

Looking to contribute?

Learn SQL on Codecademy