Given relations R and S, each has n and m tuples, respectively. After natural join of R and S, what could be the maximum numbers of tuples? I saw one given answer is n*m
but I couldn't figure out what is such a case. Please help me understand this scenario.
The result of natural join becomes equal to the Cartesian product when there are no common attributes. The given tables have a common attribute, so the result of natural join cannot have more than the number of tuples in larger table. What is the minimum possible number of tuples?
Since there are only 8 tuples in the Enroll table, the maximum number of tuples in the natural join of Student and Enroll cannot be greater than 8.
Table R contains 2 tuples, Table S contains 3 tuples, where Result table contains 2*3=6 tuples. Moreover, while performing a natural join, if there were no common attributes between the two relations, Natural join will behave as Cartesian Product.
Which of the following functional dependencies hold for relations R (A, B, C) and S (B, D, E): The relation R contains 200 tuples and the rel ation S contains 100 tuples. What is the maximum number of tuples possible in the natural join of R and S (R natural join S)
I hope, you understood what Natural Join exactly is. You can review here.
If the tables R and S contains common attributes and value of that attribute in each tuple in both tables are same, then the natural join will result n*m tuples as it will return all combinations of tuples.
Consider following two tables
Table R (With attributes A and C)
A | C
----+----
1 | 2
3 | 2
Table S (With attributes B and C)
B | C
----+----
4 | 2
5 | 2
6 | 2
Result of natural join R * S (If domain of attribute C in the two tables are same )
A | B | C
---+---+----
1 | 4 | 2
1 | 5 | 2
1 | 6 | 2
3 | 4 | 2
3 | 5 | 2
3 | 6 | 2
You can see both R and S contain the attribute C whose value is 2 in each and every tuple. Table R contains 2 tuples, Table S contains 3 tuples, where Result table contains 2*3=6 tuples.
Hope this will help.
Writing this post as I could not add to Surajeet's answer
Number of Tuples after a join (R>< S) for relation R(A,B,C) and S(C,D,E) is given by T(R>< S) =
where V(R,C) is distict values of C in relation R and V(S,C) is distict values of C in relation S
in extreme case if there is only 1 distinct value and that value is same (assuming conservation of value sets). Then we get T(R>< S) = T(R) * T(S). Hence n*m.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With