GATE 2024 CS (CS2) – Question 45
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
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.