What is the maximum number of tuples that can be returned by natural join?

2.7k views Asked by At

Consider that the relation R(A,B,C) contains 200 tuples and relation S(A,D,E) contains 100 tuples, then the maximum number of tuples possible in a natural join of R and S.

Select one:

A. 300 B. 200 C. 100 D. 20000

It will be great if the answer is provided with some explanation.

3

There are 3 answers

0
philipxy On

Natural join returns all tuple values that can be formed from (tuple-joining or tuple-unioning) a tuple value from one input relation and a tuple value from the other. Since they could agree on a single subtuple value for the common set of attributes, and there could be unique values for the non-common subtuples within each relation, you could get a unique result tuple from every pairing, although no more than that. So the maximum number of tuples is the product of the tuple counts of the relations.

Here that's D 20000.

4
Adithya Moorthy On

The maximum number of tuples possible in natural join will be 20000. You can find what natural join exactly is in this site. Let us check for the given example:

Let the table R(A,B,C) be in the given format:

  A  |  B  |  C
 ---------------
  1  |  2  |  4
  1  |  6  |  8
  1  |  5  |  7

and the table S(A,D,E) be in the given format:

  A  |  D  |  E 
 ---------------
  1  |  2  |  4
  1  |  6  |  8

Here, the result of natural join will be:

  A  |  B  |  C  |  D  |  E  
 --------------------------
  1  |  2  |  4  |  2  |  4
  1  |  2  |  4  |  6  |  8
  1  |  6  |  8  |  2  |  4
  1  |  6  |  8  |  6  |  8
  1  |  5  |  7  |  2  |  4
  1  |  5  |  7  |  6  |  8

Thus we can see the resulting table has 3*2=6 rows. This is the maximum possible value because both the input tables have the same single value in column A (1).

2
Praveen_07 On

A and A present in R and S so according to natural join 100 tuples take part in join process.

Option C 100 is the answer.