GATE / CS ARCHIVE

GATE CSE 2024 SET 2 / QUESTION 45

Witness three distinct residents with two products

Database Management Systems · Relational Algebra & Calculus · Full GATE CSE 2024 Set 2 paper

GATE 2024 Set 2, Q45 2 marks · MCQ
Report issue

Relational Algebra & Calculus

Question 45, GATE 2024: Person(pid,city) has a unique pid per person. Using only selection, projection, cross product and rename, how many cross-product operations are minimally required to find cities with at least three residents? A 1; B 2; C 3; D 4.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Approach: Introduce one independently chosen tuple for each person that must be witnessed.

1. Derivation. Rename three copies P1, P2, P3 of Person and take their product using two binary cross products. Select equal cities and pairwise distinct pids, then project the city. This identifies exactly cities with at least three residents. With only one cross product, selection/projection/rename can expose at most two independently chosen source tuples, which cannot witness a third distinct person. Thus the minimum is 2, option B, in the stated algebra without aggregation or other operators.

2. Explanation and checks. Write P1×P2×P3 as (P1×P2)×P3. Select P1.city=P2.city=P3.city and P1.pid≠P2.pid, P1.pid≠P3.pid, P2.pid≠P3.pid, then project P1.city. All three inequalities are necessary to prevent a two-person city from reusing one person. Rename, selection and projection do not introduce an additional independently chosen resident. This lower-bound argument assumes the stated relational algebra expression model, not a materialized intermediate relation supplied from outside the expression.

Original paper, page 31 · Answer key