• edited by
166 views
1 1 vote

Consider

$\mathrm{Player}(\mathrm{playerID}, \mathrm{name}, \mathrm{position}, \mathrm{height}, \mathrm{weight}, \mathrm{team})$

$\mathrm{Game}(\mathrm{gameID}, \mathrm{homeTeam}, \mathrm{awayTeam}, \mathrm{homeScore}, \mathrm{awayScore})$

$\mathrm{GameStats}(\mathrm{playerID}, \mathrm{gameID}, \mathrm{points}, \mathrm{assists}, \mathrm{rebounds})$

Which construction correctly returns the names of Chicago Bulls players who played in every game involving the Bulls?

  1. $\mathrm{BG}=\pi_{\mathrm{gameID}}\left(\sigma_{\mathrm{homeTeam}=\text{'Chicago Bulls'}\lor\mathrm{awayTeam}=\text{'Chicago Bulls'}}(\mathrm{Game})\right)$
    $\mathrm{PG}=\pi_{\mathrm{playerID},\mathrm{gameID}}(\mathrm{GameStats})$
    $\mathrm{AllBG}=\mathrm{PG}\div\mathrm{BG}$
    $\mathrm{Result}=\pi_{\mathrm{name}}\left(\sigma_{\mathrm{team}=\text{'Chicago Bulls'}}(\mathrm{Player})\bowtie\mathrm{AllBG}\right)$
     
  2. $\mathrm{BG}=\pi_{\mathrm{gameID}}\left(\sigma_{\mathrm{homeTeam}=\text{'Chicago Bulls'}}(\mathrm{Game})\right)$
    $\mathrm{AllBG}=\pi_{\mathrm{playerID},\mathrm{gameID}}(\mathrm{GameStats})\div\mathrm{BG}$
    $\mathrm{Result}=\pi_{\mathrm{name}}(\mathrm{Player}\bowtie\mathrm{AllBG})$
     
  3. $\mathrm{Result}=\pi_{\mathrm{name}}\left(\sigma_{\mathrm{team}=\text{'Chicago Bulls'}}(\mathrm{Player})\bowtie\mathrm{GameStats}\bowtie\sigma_{\mathrm{homeTeam}=\text{'Chicago Bulls'}\lor\mathrm{awayTeam}=\text{'Chicago Bulls'}}(\mathrm{Game})\right)$
     
  4. $\mathrm{BG}=\pi_{\mathrm{gameID}}(\mathrm{Game})$
    $\mathrm{AllBG}=\pi_{\mathrm{playerID},\mathrm{gameID}}(\mathrm{GameStats})\div\mathrm{BG}$
    $\mathrm{Result}=\pi_{\mathrm{name}}\left(\sigma_{\mathrm{team}=\text{'Chicago Bulls'}}(\mathrm{Player})\bowtie\mathrm{AllBG}\right)$

1 Answer

1 1 vote

This query has two separate restrictions:

  1. We care only about Chicago Bulls players.

  2. Each selected player must have played in every Bulls game.

First build the complete set of Bulls games.

A Bulls game may have the Bulls as the home team or the away team:

$\mathrm{BG}=\pi_{\mathrm{gameID}}\left(\sigma_{\mathrm{homeTeam}=\text{'Chicago Bulls'}\lor\mathrm{awayTeam}=\text{'Chicago Bulls'}}(\mathrm{Game})\right)$

Now obtain the player-game associations:

$\mathrm{PG}=\pi_{\mathrm{playerID},\mathrm{gameID}}(\mathrm{GameStats})$

A tuple in $\mathrm{GameStats}$ indicates that the player actually played in that game.

$\therefore \mathrm{PG}\div\mathrm{BG}$ returns player IDs that occur in $\mathrm{GameStats}$ for every Bulls game.

Finally, restrict the players to the Bulls and return their names:

$\pi_{\mathrm{name}}\left(\sigma_{\mathrm{team}=\text{'Chicago Bulls'}}(\mathrm{Player})\bowtie\mathrm{AllBG}\right)$

Thus A is correct.

B considers only Bulls home games and ignores away games.

C requires only that a player appeared in at least one Bulls game.

D requires the player to have participated in every game in the entire database, not every Bulls game.


Answer : A


Note : Division is only the final step. Before dividing, you must correctly construct both the required game set and the player-game relation.

Answer:
Position:
Show:

Related questions

0 0 votes
2 2 answers
113
113 views
GO Classes asked Sep 23
113 views
Consider$\mathrm{Student}(\mathrm{sid}, \mathrm{sname}, \mathrm{major})$$\mathrm{EnrolledIn}(\mathrm{sid}, \mathrm{cid}, \mathrm{grade})$$\mathrm{Course}(\mathrm{cid}, \m...
0 0 votes
1 1 answer
84
84 views
GO Classes asked Sep 23
84 views
Let $\mathrm{R}(\mathrm{X},\mathrm{Y})$ and $\mathrm{S}(\mathrm{Y})$.Which expression is equivalent to $\mathrm{R} \div \mathrm{S}$ without using the division operator?$\...
0 0 votes
1 1 answer
77
77 views
GO Classes asked Sep 23
77 views
Consider$\mathrm{Suppliers}(\mathrm{SID}, \mathrm{sname}, \mathrm{address})$$\mathrm{Parts}(\mathrm{PID}, \mathrm{pname}, \mathrm{color})$$\mathrm{Catalog}(\mathrm{SID}, ...
0 0 votes
1 1 answer
74
74 views
GO Classes asked Sep 23
74 views
Consider$\mathrm{Student}(\mathrm{snum},\mathrm{sname},\mathrm{major},\mathrm{level},\mathrm{age})$$\mathrm{Class}(\mathrm{name},\mathrm{meets\_at},\mathrm{room},\mathrm{...