Redirected
edited by
1,728 views
1 votes
1 votes

Given two tables $R1(x,y)$ and $R2(y,z)$ with $50$ and $30$ number of tuples respectively. Find maximum number of tuples in the output of natural join between tables $R1$ and $R2$ i.e. $R1 * R2$? ($*$- Natural Join)

  1. $30$
  2. $20$
  3. $50$
  4. $1500$
edited by

3 Answers

2 votes
2 votes

$\underline{\textbf{Answer:}\Rightarrow}\;1500$

$\underline{\textbf{Explanation:}\Rightarrow}$

$\textbf{Natural Join:}$ In this, the two join attributes must have the common $\mathbf{attribute}$ in both the relations.

$\textbf{Example:}$ In worst case if all the values of the common attribute are same, then total tuples would be $\mathbf{=|m| \times |n|} = 30 \times 50 = 1500$.

$\enclose{circle}{\color{blue}{\mathbf{R_1}}}$
$\color{green}{\mathbf X}$ $\color{green}{\mathbf Y}$
1 CS
2 CS
$\vdots$ $\vdots$
$\vdots$ $\vdots$
47 CS
48 CS
49 CS
$\color{red}{50}$ CS

 

$\enclose{circle}{\color{blue}{\mathbf{R_2}}}$
$\color{green}{\mathbf Z}$ $\color{green}{\mathbf Y}$
Jeet CS
Sunny CS
$\vdots$ $\vdots$
   
$\vdots$ $\vdots$
Anil CS
Gurupreet CS
$\color{red}{30}$ CS

 

$\color{blue}{\mathrm{\enclose{circle}{R_1 \times R_2}}}$
$\color{green}{\mathbf X}$ $\color{green}{\mathbf Y}$ $\color{green}{\mathbf Z}$
1 CS Jeet
2 CS Sunny
3 CS Anil
$\vdots$ $\vdots$ $\vdots$
$\vdots$ $\vdots$ $\vdots$
$\vdots$ $\vdots$ $\vdots$
$\color{magenta}{\enclose{circle}{\mathbf{\underline{\large{1500}}-\small{tuples}}}}$ CS $\dots$

 

$\therefore$ Maximum number of tuples in the output of Natural joing between relation $\mathbf{R_1}$ and $\mathbf{R_2}=\color{magenta}{\enclose{circle}{\mathbf{\underline{\large{1500}}-\small{tuples}}}}$.

edited by
0 votes
0 votes

Answer is 1500

because they are asking maximum

also, note: they have not told is distinct, we can take y values same

let say y values are alpha

then

for R1(x,y) => 50 y alpha values

for R2(y,z) => 30 y alpha values

50 x 30 = 1500 y alpha values

our final natural join relation has x , y and z attributes with 1500 tuples where y values are alpha with same or distinct values of x and z it doesn't matter.

 

 

0 votes
0 votes
1500 is the correct answer.

Consider the following case:

I am representing the database table with relation having ordered pairs.

$R1(A,B)=\{(1,a),(2,a),(3,a)……..(49,a),(50,a)\}$

$R2(B,C)=\{(a,51),(a,52),(a,53)…….(a,78),(a,79),(a,80)\}$

Here the natural join of R1 and R2 will have 1500 rows.

This is because every row of R1 is paired with all the 30 rows of R2.

Related questions

1 votes
1 votes
2 answers
1
4 votes
4 votes
6 answers
3
soujanyareddy13 asked May 12, 2021
1,920 views
The Boolean expression $AB+A \overline{B}+\overline{A}C+AC$ is unaffected by the value of the Boolean variable _________.$A$$B$$C$$A, B$ and $C$