Skip to content
Advertisement

Incase one of the 2 tables that I am CROSS joining is having duplicates, will there be duplicates in the output as well?

Table1 :

Col1
1
2

Table2 :

Col1
A
B
B

what will be the o/p of : select Table1.col1 from Table1 cross join Table2.col1 from Table2;

Advertisement

Answer

The result set of a CROSS JOIN where one table has 2 rows and the other 3 will always have six rows. A CROSS JOIN produces a Cartesian product, where each row in one table is paired with each row in the other.

In your case:

1    A
1    B
1    B
2    A
2    B
2    B

So, there are duplicates, if that is what you are asking.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement