Consider two relations describing teams and players in a sports league:
- teams(tid, tname): tid, tname are team-id and team-name, respectively
- players(pid,pname,tid): pid, pname, and tid 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 tname as ' ?
View worked solution
Answer: A
To find the names of the players who play for the team named 'MI', we need to formulate a Tuple Relational Calculus (TRC) expression.
Step-by-Step Analysis:
-
Identify the Target Attribute:
We want to retrieve the player names (
pname). Sincepnamebelongs to theplayersrelation, our main tuple variable must range overplayers.
This gives the starting structure: This immediately eliminates options B and D, which incorrectly state . -
Join and Selection Conditions:
To filter players by their team name, we must link the
playersrelation with theteamsrelation.- We introduce a existential quantifier for a team tuple .
- The join condition is that the team ID of the player must match the team ID of the team: .
- The selection condition is that the team name must be
'MI': .
Evaluating the Options:
- Option A: Correctly specifies and includes the necessary join condition along with the team name filter.
- Option C: Missing the join condition . This query would return the names of all players in the database as long as there exists at least one team named
'MI'.
Thus, the correct TRC query is represented by Option A.
Free practice · Your answers on this page are not saved.
