Aptitude Overflow
+19 votes
1.5k views

Consider the relations r1(P, Q, R) and r2(R, S, T) with primary keys P and R respectively. The relation r1 contains 2000 tuples and r2 contains 2500 tuples. The maximum size of the join r1⋈ r2 is :

  1. 2000
  2. 2500
  3. 4500
  4. 5000
asked in Databases by (22k points) 169 206 206
retagged | 1.5k views

2 Answers

+20 votes
Best answer
the common attribute is R and it is primary key in the second relation. hence the R value is distinct for 2500 rows. hence when we join max possible number of tuples is 2000

option A
answered by (12.1k points)
selected by
@manu thakur it means here you are not considering integrity constraint(foreign key)
But even in maximum case how 0 (zero) is possible plz  explain

@manu sir i was talking regaring this .. where i was wrong , https://gateoverflow.in/2344/gate2010-43 

@sid in this question , B is the key of Relation R and It contains 200 rows.

S has common attribute B and contains 100 columns.

Natural join will result in maximum 100 records and minimum 0.
okay :)
+9 votes

Let us see two scenarios with small number of tuples r1 having 5 tuples and r2 with 3 tuples.

Scenario 1: when all the attributes in R in r1 do not match value of R in r2.

r1
PQR
5m1
6n2
7o2
8p5
9q6
r2
RST
1am
2bn
3cu

natural join on r1 and r2 would give me

PQRST
5m1am
6n2bn
702bn

 

Scenario 2: 

There are no uncommon values for R between r1 and r2

PQR
5m1
6n2
7o2
8p2
9q1

 

Natural join would give

PQRST
5m1am
6n2bn
7o2bn
8p2bn
9q1am

 

So in this case we get the max number of tuples ,which is equal to the max number of tuples in relation r1.

Generalizing this inference we can derive that ans is a)2000 =max no of tuples in r1.

answered by (3.7k points)
edited by
I guess r1 contain min no. Of tuples so the example isn't according to the question

Explanation on the other hand is very useful

@Jarvis Thanks for your explaination. Can you plz tell me what will be the minimum number of tuples according to your explaination..

Related questions

2,807 questions
1,131 answers
418 comments
31,483 users