Discussion
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, player-name 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 'MI'?
Answer: A
The correct query is { p.pname | p ∈ players ∧ ∃t (t ∈ teams ∧ p.tid = t.tid ∧ t.tname = 'MI')}.
The result must range over players, so p must be a tuple of players. A player qualifies if there exists a team tuple t that is the player's own team (p.tid = t.tid, the join condition) and whose name is 'MI'. Option A states exactly this.
Options B and D take p from teams, which has no pname attribute, so they do not even return player names. Option C drops the join condition p.tid = t.tid: as long as some team called 'MI' exists, it returns the name of every player in the league, whichever team they play for.
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development