in Databases reopened by
8,976 views
6 votes
6 votes
Consider the following relations: $R_1(A,B,C)$ and $R_2(A,D,E)$. $R_1$ has 1000 records and $R_2$ has 2000 records. The attribute $A$ in $R_2$ is referencing attribute $A$ in $R_1$. Let $X$ be minimum number of records in $R_1$ ⨝ $R_2$ and $Y$ be the maximum number of records in $R_1$⨝$R_2$. The sum of $(X+Y)$ is _______.
in Databases reopened by
9.0k views

4 Comments

I think untill unless mentioned we need not to consider.
0
0

Arnabi  what is the answer ? I will go with 2000 for numerical type.:

Anu007 :- You are suggesting 2000 or 4000 as the answer?

0
0
Taking the minimum case into consideration answer given is 2000.
0
0

3 Answers

9 votes
9 votes
Best answer

Let A in R2 be null for all the tuples as foreign keys can be null , hence natural join would result in zero tuples. Hence minimum = 0 tuples

Max records will only be generated when the value in R2(A) for all the tuples is same as any value in R1(A). Here, all values of A in R1 will be unique as it must be a key due to foreign key constraint. Hence in that case , output would be 2000.

Hence sum(min+max)=2000

selected by
2 votes
2 votes

Assume R1 has 3 tuples and R2 has 2 tuples

R1                               R2

A B C                       A D E

1 2 3                        1 8 9 

1 4 5                        1 9 10

1 6 7

R1 NATURAL JOIN R2

A B C D E

1  2 3  8 9

1  2 3  9 10

1  4 5  8  9

1  4 5  9 10

1  6 7  8  9

1  6 7  9  10

So we have 3*2 = 6 tuples.

NOTE:- Since it is not mentioned that A is key so value of A can be repeated.

So now if R1 has 1000 tuples and R2 has 2000 tuples so R1 NATURAL JOIN R2 = 1000*2000 =2000000 tuples(max)=X

Minimum number of tuples= 0=Y(when all values of A in R2 is null). Value of A in R2 can be null as it is not mentioned that A in R2 is not null.

So X-Y= 2000000-0=2000000

Correct me if I am wrong

4 Comments

yeah right
1
1
yes bt in qstn it is not mentioned that A is primary key and since it is not mentioned and we need to find max number of tuples so we take 2000*1000
0
0
By default any attribute referred to by a foreign key must be unique making it a key. So, this need not be explicitly mentioned.
3
3
0 votes
0 votes
I think minimum can be zero becoz we have to take worst case condition if nothing is mentioned.....pls let me know if I am wrong

Related questions

2 votes
2 votes
1 answer
2