14.g.    Get a list of all the players from the Buffalo Sabres (Team Name = ‘Buffalo’) who played against Dallas in winning games at home (in Buffalo) in the months of either January or March of 2001 (Note that both January and March have 31 days: i.e., 01/01/01 to 01/31/01 and 03/01/01 to 03/31/01). Notice also that some players who played with Buffalo might not have been with the Sabres during those times. You will have to check the dates they started and ended).

 

SELECT DISTINCT playername

from game, team, employs, player

WHERE teamname = 'Buffalo'

AND team.teamID = hometeam

AND visitingteam = '1234'

AND htscore > vtscore

AND ((gamedate >= '01-JAN-2001' AND gamedate < '01-FEB-2001')

     OR (gamedate >= '01-APR-2001' AND gamedate < '01-MAY-2001'))

AND team.teamID = employs.teamID

AND employs.playerID = player.playerID

AND gamedate >= startdate

AND (gamedate <= enddate OR enddate IS NULL)

ORDER BY playername;

 

Which yields the output:

 

no rows selected