Aptitude Overflow

+19 votes

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

- 2000
- 2500
- 4500
- 5000

+20 votes

Best answer

+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.

P | Q | R |

5 | m | 1 |

6 | n | 2 |

7 | o | 2 |

8 | p | 5 |

9 | q | 6 |

R | S | T |

1 | a | m |

2 | b | n |

3 | c | u |

natural join on r1 and r2 would give me

P | Q | R | S | T |

5 | m | 1 | a | m |

6 | n | 2 | b | n |

7 | 0 | 2 | b | n |

Scenario 2:

There are no uncommon values for R between r1 and r2

P | Q | R |

5 | m | 1 |

6 | n | 2 |

7 | o | 2 |

8 | p | 2 |

9 | q | 1 |

Natural join would give

P | Q | R | S | T |

5 | m | 1 | a | m |

6 | n | 2 | b | n |

7 | o | 2 | b | n |

8 | p | 2 | b | n |

9 | q | 1 | a | m |

**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.**

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

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..

- All categories
- General Aptitude 1.2k
- Engineering Mathematics 4.7k
- Digital Logic 1.9k
- Programming & DS 3.5k
- Algorithms 3k
- Theory of Computation 3.7k
- Compiler Design 1.5k
- Databases 2.8k
- CO & Architecture 2.5k
- Computer Networks 2.8k
- Non GATE 835
- Others 1.2k
- Admissions 258
- Exam Queries 388
- Tier 1 Placement Questions 17
- Job Queries 49
- Projects 6

2,807 questions

1,131 answers

418 comments

31,483 users