第一题:列出每個國家的名字 name,當中人口 population 是高於俄羅斯’Russia’的人口。
SELECT name FROM world
WHERE population >
(SELECT population FROM world
WHERE name='Russia');
这题给出了代码,改了一下国家名就完事啦。
第二题:列出歐州每國家的人均GDP,當中人均GDP要高於英國’United Kingdom’的數值。
select name
from world
where continent = 'Europe'
and gdp/population > (select gdp/population from world where name = 'United Kingdom');
这题对我来说有两个坑:
- 人均GDP=gdp/population(QAQ显得我好没文化啊,这都不知道的样子)
- 列出的是
name
,最开始我选择列出的是人均GDP,就错了。(害,这是我的锅嘛。。好吧,是的)
第三题:在阿根廷Argentina 及 澳大利亞 Australia所在的洲份中,列出當中的國家名字 name 及洲分 continent 。按國字名字順序排序
select name, continent
from world
where continent in (select continent from world
where name in