A B C D
1 3 3 3
3 3
The result is apparently, after natural joining
A B C D
1 3 3 3
3 3 3 3
Why is this? I thought natural join required there to be a similar attribute in the two cases? There’s not even a C or D attribute in the first table, so how could they join?
For instance, our prof said these two join because for the first resulting row, the C’s are the same, and the same for the second.
A B C C D
1 2 3 3 1
4 5 6 6 2
7 8 9
Or do they just merge normally? If there was a 2 1 after 6 2 in the second table there, how would the merge appear?
Cross joins do not require any sort of matching condition – every row in Set A is matched with every row in Set B.
Other types of joins (
INNER,OUTER,LEFT,RIGHT) all match on a condition and so are generally more limited (i.e. “only join a row of Set A with a row of Set Biff(if and only if) the value in theCcolumn of Set A matches the value in theCcolumn in Set B”).However, you can make such joins effectively
CROSSjoins by simply making the condition always be true: