Javatpoint Logo
Javatpoint Logo

PostgreSQL Cross Join

The CROSS JOIN matches every row of the first table with every row of the second table. It is also known as Cartesian product join. If the table1 has "x" columns and table2 has "y" columns then the resultant table will has the (x+y) columns.

Syntax:

See this example:

Let's take a table "EMPLOYEES" having the following data.

Table1: EMPLOYEES

PostgreSQL cross join1

Create another table "DEPARTMENT" having the following data.

Table2: DEPARTMENT

PostgreSQL cross join2

Execute the following query:

Output:

PostgreSQL cross join3



Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA