Suppose database table T1(P, R) currently has tuples {(10, 5), (15, 8), (25, 6)} and table T2 (A, C) currently has {(10, 6), (25, 3), (10, 5)}. Consider the following three relational algebra queries RA1, RA2 and RA3:
RA1 : T1 ⨝ T1.P = T2.A T2 where ⨝is natural join symbol
RA2 : T1 ⟕ T1.P = T2.A T2 where ⟕ is left outer join symbol
RA3 : T1 ⨝ T1.P = T2.A and T1.R = T2.CT2
The number of tuples in the resulting table of RA1, RA2 and RA3 are given by:
(A)
2, 4, 2 respectively
(B)
2, 3, 2 respectively
(C)
3, 3, 1 respectively
(D)
3, 4, 1 respectively
Answer: (D)
Explanation:
RA1 : T1 ⨝ T1.P = T2.A T2 where ⨝is natural join symbol. It will result in 3 tuples:
P = A | R | C |
---|---|---|
10 | 5 | 6 |
10 | 5 | 5 |
25 | 6 | 3 |
RA2 : T1 ⟕ T1.P = T2.A T2 where ⟕ is left outer join symbol. It will result in 4 tuples.
P = A | R | C |
---|---|---|
10 | 5 | 6 |
10 | 5 | 5 |
15 | 8 | Null |
25 | 6 | 3 |
RA3 : T1 ⨝ T1.P = T2.A and T1.R = T2.CT2. It will result in 1 tuple.
P = A | R = C |
---|---|
10 | 5 |
So, option (D) is correct.
Quiz of this Question
Please comment below if you find anything wrong in the above post