【SQL】9.SQLZOO练习4--SELECT from SELECT Tutorial

题目链接:https://sqlzoo.net/wiki/SELECT_within_SELECT_Tutorial

1
select name from world 
where population > (select population from world where name='Russia')
2
select name from world 
where gdp/population > 
(select gdp/population from world where name='United Kingdom') 
and continent = 'Europe'
3
select name,continent from world 
where continent in 
(select continent from world where name in ('Argentina','Australia'))
order by name
4
select name,population from world 
where population >
(select population from world where name='Canada') 
and
population < (select population from world where name='Poland')  
5
select name,concat(round(population*100/(select population from world 
where name='Germany' ) ,0),'%') from world 
where continent='Europe'
讲解
6
select name from world
where gdp > (select max(gdp) from world 
where continent='Europe')
7
select continent,name,area from world x
where area >= ALL
(select area from world y
where y.continent=x.continent
and area >0)
8
SELECT continent, MIN(name) AS name
FROM world 
GROUP BY continent
ORDER by continent
9
select name,continent,population from world x
where 25000000>=all
(select population from world y
where y.continent=x.continent)
10
select name,continent from world x
where x.population/3 >= all
(select population from world y
where y.continent=x.continent
and y.name!=x.name)
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容