Skip to main content

GATE CSE 2024Databases › Relational Algebra & CalculusVerified

GATE CSE 2024 PYQ: ​​​​​The relation schema, Person (pid, city), describes the city of residence for every person uniquely…

​​​​​The relation schema, Person (pid, city), describes the city of residence for every person uniquely identified by pid. The following relational algebra operators are available: selection, projection, cross product, and rename.

To find the list of cities where at least 3 persons reside, using the above operators, the minimum number of cross product operations that must be used is

  1. A
    1
  2. B
    2
    Correct answer
  3. C
    3
  4. D
    4

Answer

(B) 2 2 2

Approach

To identify cities with at least three residents, we need to compare three distinct Person tuples that share the same city. Since only binary cross product is available, we must combine three renamed copies of Person using two cross products: first combine two copies into a same-city pair of distinct persons, then combine that result with a third copy to enforce a distinct triple.

The condition 'at least 3 persons reside in a city' requires checking the existence of three distinct Person tuples with equal city values. Since cross product is binary, two cross product operations are necessary and sufficient: one to form same-city pairs and one to extend those pairs to same-city triples with distinct pids. Thus the minimum number is 2.

Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.