So I got two relations with two common attributes. For one of those attributes, the attribute values in two of the tuples of those relations are the same, for the other they aren't.
How does my result after a natural join look like?

A B C     B C D
1 2 3     2 3 4
5 6 7     6 8 9
I would join the first tuples of both relations, since there's 2/3 in both of them. What about the second tuples? There's 6/7 on the left, and 6/8 on the right.

  • 1
    $\begingroup$ this is out of scope for this site. Maybe it's better off on cs.SE. this site is for research-level questions. $\endgroup$ May 7 '13 at 22:20

As said in Wikipedia (http://en.wikipedia.org/wiki/Relational_algebra#Natural_join_.28.E2.8B.88.29), natural join $X \bowtie Y$ contains unions of pairs $x \in X$, $y \in Y$ which have $X$'s and $Y$'s all common attributes equal.

So, in your case, natural join would consist of only one tuple $\{ \langle A = 1, B = 2, C = 3, D = 4 \rangle \}$


Not the answer you're looking for? Browse other questions tagged or ask your own question.