Curated · Relational Algebra

MCQ · 1 mark · Problem DBMS-RELM-0099

Relations \(R(A, B)\) and \(S(B, C)\) contain \(5\) and \(4\) tuples respectively. \(B\) is the primary key of \(S\), and no foreign key is declared between the two relations.The minimum and the maximum possible numbers of tuples in the natural join \(R \bowtie S\) are
  1. A
    \(0\) and \(5\)
  2. B
    \(0\) and \(20\)
  3. C
    \(4\) and \(5\)
  4. D
    \(5\) and \(5\)

Solve it on GATE DA practice →More Relational Model & SQL problems

Show the worked solution\[\boxed{|R \bowtie S| = \big|\{\, r \in R : r[B] \in \pi_B(S) \,\}\big| \quad\text{when } B \text{ is a key of } S}\]Each tuple of \(R\) meets at most one tuple of \(S\) (the \(B\) values of \(S\) are distinct), so the join has at most \(5\) tuples; this happens when every \(B\) value of \(R\) occurs in \(S\).Without a foreign key, the \(B\) values of \(R\) may all be missing from \(S\), giving \(0\) tuples.\(20 = 5 \times 4\) is the Cartesian-product size, impossible here; "\(5\) and \(5\)" would need \(R.B\) to be a foreign key referencing \(S\).Answer: A

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com