Databases
Consider three tables with following number of tuples in each
S(a,b,c) = 100
R(a,d,e) = 80
T(x,d,f) = 90
Tuples in S and R with same value of attribute "a" = 60
Tuples in R and T with same value of attribute "d" = 70
Maximum and minimum number of tuples in (S left outer join R)
full outer join T is:
Options
1. 130 120
2. 150 140
3. 140 130
4. 140 120
Ans: 3
Explanation:
Consider, X = ( S left outer join R ) This will have 100
rows, with d = null for 40(100-60) rows.
X full outer join T: Here, the common values of d in
tables X and T can be between 50 and 60.
Case 1: Minimum value of common values of d between
X and T
Out of 80 values of d in R, 20 were not found in X (since X has only
60 non-null values of d). These 20 can all be the ones that were common
between S and T. In this case the common values between X and T will
be 50.
Case 2: Maximum value of common values of d between
X and T
Now assume that 20 values of d that were lost, none was common between
S and T. But this is not possible, because S has 80 tuples and 70
values are common with T. So at least 10 common values will get lost.
Thus max. value of common d's will b 60.
Now full outer join (X + T - common values of d in X and T) will be
either
100 + 90 - 50 or 100 + 90 - 60.
Thus the answer is 140,130. Hence 3
|