The GATE Grind

GATE 2024 CS (CS2) – Question 45

Databases · Relational Model: Relational Algebra, Tuple Calculus, SQL · 2 marks · Multiple choice

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. 1
  2. 2
  3. 3
  4. 4

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (B) 2

Explanation

Take three renamed copies of Person, requiring 2 cross products, and select tuples with the same city and pairwise distinct pids, then project city.