Maximum number of tuples in a natural join

Given the ratios R and S, each has n and m sets, respectively. After naturally combining R and S, what can be the maximum number of tuples? I saw one answer: n*mbut I could not understand what it was. Please help me understand this scenario.

+4
source share
2 answers

I hope you understand what Natural Join is. You can view it here .

If tables R and S contain common attributes and the value of this attribute is the same in each tuple in both tables, then the natural join will result in n * m tuples, since it will return all combinations of tuples.

Consider the following two tables

R ( A C)

 A  |  C
----+----
 1  |  2
 3  |  2

S ( B C)

 B  |  C
----+----
 4  |  2
 5  |  2
 6  |  2

R * S ( C )

 A | B |  C
---+---+----
 1 | 4 |  2
 1 | 5 |  2
 1 | 6 |  2
 3 | 4 |  2
 3 | 5 |  2
 3 | 6 |  2    

, R S C, 2 . R 2 , S 3 , 2 * 3 = 6 .

, .

+6

, Surajeet

(R > < S) R (A, B, C) S (C, D, E) T (R > < S) =

Number of tuples to join

V (R, C) - C R V (S, C) - distict C S

, 1 , ( ). T (R > < S) = T (R) * T (S). , n * m.

0

All Articles