RSS Feed

SQL Cross Join

SQL Cartesian product:

You will be able to find Cartesian product with a Cartesian join. When we join every row of a table to every row of another table we get Cartesian join


SQL Cross Join:


Cross joins, where every row from one table is matched with every row from another.


Cartesian join and Cross join are one and the same thing.


If T1 and T2 are two sets then cross join = T1 X T2.


Examples of a cross join:


SELECT *
FROM emp CROSS JOIN dept


SELECT *
FROM emp, dept;

In the first example above it is explicitly written that it is a CROSS JOIN but in the second one it is implicit.

No comments:

Post a Comment