What is SQL- CARTESIAN or Cross JOIN ?
- The cross join returns a Cartesian product of rows from both tables.
- It Returns All rows from first table, Each row from the first table is combined with all rows from the second table
If Table 1 Contains n rows and Table 2 contains m rows
Then cross join of both the tables will return m*n rows.
SELECT select_List FROM Table1 cross join Table2;
Table 1 – Department
Consider Department table having below records.
Table 2 – Student
Consider Student table having below records.
Select * from Student cross join Department
After executing above query , we will find the below result: