SqlZoo.net习题答案:How to do joins.【Table Tennis】
2012-06-02 00:40
507 查看
习题地址:http://sqlzoo.net/3b.htm
表结构: ttms(games, color, who, country)
country(id, name)
ttms.county = county.id
1b.Show the who and the color of the medal for the medal winners from 'Sweden'.
1c.Show the years in which 'China' won a 'gold' medal.
表结构: ttws(games, color, who, country)
games(yr, city, country)
ttws.games = games.yr
2a.Show
2b.Show which city 'Jing Chen' won medals. Show the
2c.Show
表结构: ttms(games, color, who, country)
country(id, name)
ttms.county = county.id
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.id) where country.name = 'Sweden'
1c.Show the years in which 'China' won a 'gold' medal.
select games from ttms join country on (ttms.country = country.id) where country.name = 'China' and ttms.color = 'gold'
表结构: ttws(games, color, who, country)
games(yr, city, country)
ttws.games = games.yr
2a.Show
whowon 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
cityand the medal
color.
select games.city, color from ttws join games on (ttws.games = games.yr) where ttws.who = 'Jing Chen'
2c.Show
whowon the gold medal and the
city.
select ttws.who, games.city from ttws join games on (ttws.games = games.yr) where ttws.color = 'gold'
相关文章推荐
- SqlZoo.net习题答案:How to do joins.【Album】
- SqlZoo.net习题答案:Using the SELECT statement.【bbc】
- SqlZoo.net习题答案:Using nested SELECT.
- SqlZoo.net习题答案:Using SUM, COUNT, MAX, AVG, DISTINCT and ORDER BY.
- SqlZoo.net习题答案:NULL, INNER JOIN, LEFT JOIN, RIGHT JOIN
- SqlZoo.net习题答案:Using the SELECT statement.【nobel】
- SqlZoo.net习题答案:The Join 【Movie】
- How to do...well...anything...in DB2 SQL
- CodeSnip: How to Get Id of the Record Using ASP.NET and SQL Server 2000
- How do I add a ProgressBar to a .NET StatusBar
- 走进Linq-Linq to SQL How do I(2)
- [转][ASP.NET]How to easily insert row in GridView with SqlDataSource?
- How to do sql injections with SQLMAP
- How do I get ASP.NET Web API to return JSON instead of XML using Chrome
- How to run the .net code within the Sql server
- 走进Linq-Linq to SQL How do I(3)
- How to Use Lucene.NET with Windows Azure SQL Database
- How do I write a LINQ to Entities query which has the equivalent of the SQL “in” keyword?
- 《java how to program》第三版1-6章大部分习题答案[原创]
- Linq to SQL how to do “where [column] in (list of values)”