Consider two relations describing \(π‘‘π‘’π‘Žπ‘šπ‘  \) and \(π‘π‘™π‘Žπ‘¦π‘’π‘Ÿπ‘  \) in a…

2025

Consider two relations describingΒ \(π‘‘π‘’π‘Žπ‘šπ‘  \) andΒ \(π‘π‘™π‘Žπ‘¦π‘’π‘Ÿπ‘  \) in a sports league:

β€’Β \(π‘‘π‘’π‘Žπ‘šπ‘ (𝑑𝑖𝑑,π‘‘π‘›π‘Žπ‘šπ‘’): 𝑑𝑖𝑑, π‘‘π‘›π‘Žπ‘še\) are team-id and team-name, respectively

β€’ \(π‘π‘™π‘Žπ‘¦π‘’π‘Ÿπ‘ (𝑝𝑖𝑑, π‘π‘›π‘Žπ‘šπ‘’,𝑑𝑖𝑑): 𝑝𝑖𝑑, π‘π‘›π‘Žπ‘šπ‘’\), andΒ \(𝑑𝑖𝑑\) denote player-id, playername and the team-id of the player, respectively

Which ONE of the following tuple relational calculus queries returns the name of the players who play for the team having π‘‘π‘›π‘Žπ‘šπ‘’ as β€²\(𝑀𝐼\)β€²?

Attempted by 101 students.

Show answer & explanation

Correct expression: { p.pname | p ∈ players ∧ βˆƒt (t ∈ teams ∧ p.tid = t.tid ∧ t.tname = 'MI') }

Why this is correct:

  • The main variable p ranges over the players relation, so p.pname refers to a valid player name.

  • The existentially quantified tuple t ranges over teams and provides the team context to test.

  • The equality p.tid = t.tid links a player to their team, ensuring we only consider the player's own team.

  • The condition t.tname = 'MI' filters to the specific team named 'MI'. Combined, these return exactly the players who play for 'MI'.

Why the other expressions are wrong:

  • Expressions that bind the main variable to the teams relation and then try to return p.pname are invalid because team tuples do not have a player-name attribute.

  • Expressions that omit the equality p.tid = t.tid fail to link players to teams; such a query would return every player's name whenever any team named 'MI' exists, which is not the intended result.

  • Swapping the roles of the quantified relation (making the existential range over players while treating the main variable as a team) also mismatches attributes and produces incorrect or meaningless conditions.

Summary: The correct query binds the result variable to players, uses an existential team tuple to find a matching team by id, and filters that team by name 'MI'.

A video solution is available for this question β€” log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir