GATE 2024 DA – Question 26
Consider a database that includes the following relations:
Defender(name, rating, side, goals)
Forward(name, rating, assists, goals)
Team(name, club, price)
Which ONE of the following relational algebra expressions checks that every name occurring in Team appears in either Defender or Forward, where $\phi$ denotes the empty set?
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (C) $\Pi_{name}(Team) \setminus (\Pi_{name}(Defender) \cup \Pi_{name}(Forward)) = \phi$
Explanation
Every name in Team must be in Defender or in Forward, which is a union. The set of Team names that are not in this union must be empty: $\Pi_{name}(Team) \setminus (\Pi_{name}(Defender) \cup \Pi_{name}(Forward)) = \phi$. Option A uses an intersection, and B and D take the difference the wrong way round.