Wednesday, October 3, 2007

Joins....2

2a. Show who won medals in the 'Barcelona' games
SELECT who FROM ttws
JOIN games ON (ttws.games=games.yr)
WHERE city = 'Barcelona'

2b. Show which city 'Jing Chen' won medals. Show the city and the medal color.
select city, color from
ttws join games on ttws.games = games.yr
where who = 'jing chen'


2c. Show who won the gold medal and the city.
select who,city from
ttws join games on ttws.games = games.yr
where color = 'gold'

No comments: