Open In App

SQL CROSS JOIN

Last Updated : 21 Nov, 2025
Comments
Improve
Suggest changes
5 Likes
Like
Report

SQL CROSS JOIN creates a Cartesian product of two tables, meaning it returns every possible combination of rows from both tables. It does not use a join condition, and the total number of rows in the result is the number of rows in the first table multiplied by the number of rows in the second table. It is useful for generating all combinations of data.

cross_join
CROSS JOIN

Syntax:

SELECT * FROM table1
CROSS JOIN table2;

Examples of SQL CROSS JOIN

Before diving into queries, let’s create two sample tables: Customer and Orders. These tables will help us understand how CROSS JOIN combines data into multiple combinations.

customer-1
Customers
Orders
Orders

Query:

SELECT * 
FROM Customer
CROSS JOIN Orders;

Output:

Orders-output

Explanation: CROSS JOIN combines every row from the Customer table with every row from Orders table. Since there are 2 customers and 2 orders, result contains 2 × 2 = 4 rows.


Explore