in Databases retagged by
1,008 views
5 votes
5 votes

in Databases retagged by
1.0k views

3 Comments

X=Y=2000 ??
0
0
Yes @prabhanjan_1
1
1
0
0

2 Answers

11 votes
11 votes
Best answer

For minimum and maximum no of tuples resulted due to the natural join and in which we have a common attribute P which is foreign key in relation R2 referencing to R1's primary key P.So since the common attribute is a foreign key here , we have to take care of integrity constraints of a foreign key as well.So let us consider the 2 extremes :

Case 1 : All tuples of R2 have same value of P

In that case , all tuples of R2 will match with exactly one tuple of R1 as in natural join we join the tuples based on the value of common attribute if they are found to be same.So in this case all the 2000 tuples of R2 will combine with exactly one of the tuples of R1.

Hence no of tuples that will result in R1 natural join R2 = 2000

Case 2 : P value is uniformly distributed over R2 tuples :

By that we mean every 2 tuple of R2 is matched with one tuple of R1 , so all the 1000 values of P in R1 is uniformly distributed over R2.

Therefore due to one value of P in R1 , we have 2 matchings with R2 , natural join results 2 tuples .

So for entire natural join of R1 and R2 = 2 * 1000

                                                       = 2000 tuples

Hence in any case we are going to have 2000 tuples in the natural join only since a tuple of R2 is going to match with at least one tuple of R1 as the common attribute P of Rreferencees to Rand also P is non null in R2 so it is guaranteed that matching of each tuple in R2 is going to happen.

Hence , maximum = minimum no of tuples = 2000 tuples

Therefore , X + 2Y   =   2000 + 4000

                              =   6000

selected by

4 Comments

read the QS thor
0
0
Sorry.
0
0
its wrong
0
0
0 votes
0 votes
If we look carefully ,in R1 P is primary key ,means there are 1000 distinct values of P in R1 . Now look at R2 , there P is not primary key , rather S is its primary key , means PS is an key . So in R2 though there are 2000 tuples , there may be repetitions of P in R2 .

Max : for every element in R2 there's an element in R1 , imagine a one to one mapping between R1 and R2 . Total 1000 matches may occur.The reason is once an element in R2 matches in R1 it cant match to any other tuple in R1.

min = max , Try to think this through the explanation is same

hence X=Y=1000

Therefore X+2Y = 3000.

Related questions