A cross join that does not have a WHERE
clause produces the Cartesian product of the tables participating in the join.
Result of Cross Join is like Cartesian product of the number of
rows in the first table multiplied by the number of rows in the second table
i.e. each row from the first table is combined with each row from the second
table.
A cross join returns all possible
combinations of all rows from both the tables. So basically it is like joining
everything to everything.
Example for Cross Join or Cartesian Product
Consider Employee Table
Consider Department table
Query for cross join :
SELECT * FROM EmDetails CROSS JOIN Tb_Dept
SELECT * FROM EmDetails , Tb_Dept
No comments:
Post a Comment