sql练习:SELECT within SELECT Tutorial - SQLZoo
world表:
| name | continent | area | population | gdp |
|---|---|---|---|---|
| Afghanistan | Asia | 652230 | 25500100 | 20343000000 |
| Albania | Europe | 28748 | 2831741 | 12960000000 |
| Algeria | Africa | 2381741 | 37100000 | 188681000000 |
| Andorra | Europe | 468 | 78115 | 3712000000 |
| Angola | Africa | 1246700 | 20609294 | 100990000000 |
| ... | ||||
world(name, continent, area, population, gdp)
1. select...where...(...select...)
List each country name where the population is larger than that of 'Russia'.
SELECT name FROM world
WHERE population >
(SELECT population FROM world
WHERE name='Russia')
2.
Show the countries in Europe with a per capita GDP greater than 'United Kingdom'.
Per Capita GDP?
The per capita GDP is the gdp/population
Europe是在continent里面筛选,不是area
select name
from world
where continent = 'Europe'
and gdp/population >
(select gdp/po

最低0.47元/天 解锁文章
2405

被折叠的 条评论
为什么被折叠?



