Wednesday, October 3, 2007

Joins....

1a. Show the athelete (who) and the country name for medal winners in 2000.
SELECT who, country.name FROM ttms JOIN country ON (ttms.country=country.id) WHERE games = 2000


1b. Show the who and the color of the medal for the medal winners from 'Sweden'.
SELECT who,color from ttms join country on ttms.country = country.idwhere name = 'sweden'


1c. Show the years in which 'China' won a 'gold' medal.
select games,country from ttms join country on ttms.country = country.idwhere name = 'china' andcolor = 'gold'order by games desc

No comments: