CS FundamentalsModerateGATE CS (PYQ pattern)

R(A, B) has 1000 tuples; S(B, C) has 500 tuples with B a key of S; T(C, D) has 200 tuples with C a key of T, and S.C is a NOT NULL foreign key referencing T. R.B is not a foreign key. What are the minimum and maximum possible sizes of R join S join T (natural joins)?

  1. A. 0 to 1000
  2. B. exactly 1000
  3. C. 0 to 500
  4. D. 0 to 100,000,000

Correct answer: A. 0 to 1000

S join T has exactly 500 tuples (each S row finds its one T row). Joining R on B, each R row matches at most one S row (B is a key of S), so at most 1000; since R.B need not exist in S, the minimum is 0. 'Exactly 1000' would need R.B to be a NOT NULL foreign key.

More DBMS and SQL questions

Exams that ask this topic