How many tuples would result in a natural join operation / The number of records that a natural join produce in relational algebra
Question:
9. Assume a relation R(A, B, C) with n tuples(records) and a relation S(C, D) with m tuples. Let us suppose that the Natural Join (⋈) between R and S (ie., R ⋈ S) produces t tuples as the result. Which of the following (n, m, t) number of tuples is TRUE for this natural join?
(a) (6, 12, 720)
(b) (1, 1, 3)
(c) (10, 5, 2)
(d) (10, 5, 100)
Answer:
(c) (10, 5, 2)
Natural Join (⋈) between R and S can result in maximum of nXm number of records if n and m are the number of tuples in R and S respectively. This is the maximum limit. It can never exceed this. Natural join matches the value of common attributes of both tuples. If there is a match, then result will include that tuple. If no match that tuple will be discarded. Hence, a natural join may results in minimum zero and maximum nXm records. The result (10, 5, 2) may be true if we have 10 records in R and 5 records in S and only two tuples matches the join condition.
For (6, 12, 720), 720 > 6 * 12. Hence, it is impossible.
For (1, 1, 3), 3 > 1 * 1. Hence, it is impossible.
For (10, 5, 100), 100 > 10 * 5. Hence, it is impossible.
No comments:
Post a Comment