Dark Mode

1,008 views

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 R_{2} referencing to R_{1}'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 R _{2} have same value of P**

In that case , all tuples of R_{2} will match with exactly one tuple of R_{1} 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 R_{2} will combine with exactly one of the tuples of R_{1.}

Hence no of tuples that will result in R_{1} natural join R_{2} = 2000

**Case 2 : P value is uniformly distributed over R _{2} tuples :**

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

Therefore due to one value of P in R_{1} , we have 2 matchings with R_{2} , natural join results 2 tuples .

So for entire natural join of R_{1} and R_{2} = 2 * 1000

= 2000 tuples

Hence in any case we are going to have 2000 tuples in the natural join only since a tuple of R_{2} is going to match with at least one tuple of R_{1} as the common attribute P of R_{2 }referencees to R_{1 }and also P is non null in R_{2} so it is guaranteed that matching of each tuple in R_{2} is going to happen.

**Hence , maximum = minimum no of tuples = 2000 tuples**

**Therefore , X + 2Y = 2000 + 4000**

** = 6000**

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.

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.