-1

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.

philipxy
  • 14,867
  • 6
  • 39
  • 83
Praveen_07
  • 170
  • 2
  • 12
  • What did you get so far? Please read [ask] including about homework. – philipxy Aug 30 '17 at 10:01
  • Does this answer your question? [maximum and minimum number of tuples in natural join](https://stackoverflow.com/questions/22673235/maximum-and-minimum-number-of-tuples-in-natural-join) – philipxy May 10 '20 at 23:07

3 Answers3

3

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

philipxy
  • 14,867
  • 6
  • 39
  • 83
  • Thanks Adithya for your response. I guess you are doing a cross join. I guess natural join is a type of equi join in which columns with the same name of associated tables will appear once only. – Praveen_07 Aug 30 '17 at 06:56
  • @Praveen_07 Natural join is not "a kind of equijoin". It returns what we get if we equijoin then drop one of the equated attributes. However, they return the same number of rows. This answer & your question clearly use natural join but not cross join. Your (unsound) reasoning seems to be that since a cross join row count is the product of input table row counts, if a result has that row count it must be a cross join. You are wrong. Other joins can have that count too. Read the answer. Read definitions. PS A natural join on no attributes is a cross join. Some algebras have other cross joins. – philipxy Aug 30 '17 at 10:00
  • This is one of the cases in which the natural join returns result with row count as product of the input table row counts. This happens because both the input tables have the same value in common column. Also, Thanks @philipxy – Adithya Moorthy Aug 30 '17 at 10:43
  • Yes. Per my edit to your question, it is clearer (idomatically) in English to say that it is because the input tables have the same *single* value in the common column. Ie both tables have just one value in the common column, and it is the same value in both tables. (Always use enough sentences and words to be clear.) (See also my answer.) – philipxy Aug 30 '17 at 10:50
1

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.

philipxy
  • 14,867
  • 6
  • 39
  • 83
-2

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.

Praveen_07
  • 170
  • 2
  • 12
  • This is not clear. If it were clear, it would be wrong. – philipxy Aug 30 '17 at 10:05
  • Downvoted: if we're talking about Natural Join, the number of tuples in the result might be anything between zero and 20,000 (the product of the number of tuples in each operand). Exactly how many depends on the content of relations R, S. But the question isn't clear: what does "maximum number of tuples possible" mean? – AntC Aug 31 '17 at 06:00