What is the SQL CROSS JOIN?

In SQL, the CROSS JOIN is used to combine each row of the first table with each row of the second table. It is also known as the Cartesian join since it returns the Cartesian product of the sets of rows from the joined tables.

svg viewer

Syntax

There are two implementations of the CROSS JOIN statement:

  • Using the CROSS JOIN syntax.
  • Using the FROM clause without using a WHERE clause.

1. Using the CROSS JOIN clause

In this implementation, we specify the keyword CROSS JOIN in between the table names we want to join.

SELECT      [column names]
FROM        [Table1]
CROSS JOIN  [Table2]

2. Using the FROM clause without using a WHERE clause.

In this implementation we use the FROM keyword along with the table names; these names are separated by commas.

SELECT [column names]
FROM   [Table1], [Table2]

Examples

Consider the two tables, called employee and department, below:

svg viewer

Executing cross join on these gives us the following output:

/*CROSS JOIN*/
SELECT *
FROM employee
CROSS JOIN department

Unlock your potential: SQL joins series, all in one place!

To continue your exploration of SQL joins, check out our series of Answers below:

New on Educative
Learn to Code
Learn any Language as a beginner
Develop a human edge in an AI powered world and learn to code with AI from our beginner friendly catalog
🏆 Leaderboard
Daily Coding Challenge
Solve a new coding challenge every day and climb the leaderboard

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved