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

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

【SQL】9.SQLZOO练习4--SELECT from SELECT Tutorial_第1张图片
1
select name from world 
where population > (select population from world where name='Russia')
【SQL】9.SQLZOO练习4--SELECT from SELECT Tutorial_第2张图片
2
select name from world 
where gdp/population > 
(select gdp/population from world where name='United Kingdom') 
and continent = 'Europe'
【SQL】9.SQLZOO练习4--SELECT from SELECT Tutorial_第3张图片
3
select name,continent from world 
where continent in 
(select continent from world where name in ('Argentina','Australia'))
order by name
【SQL】9.SQLZOO练习4--SELECT from SELECT Tutorial_第4张图片
4
select name,population from world 
where population >
(select population from world where name='Canada') 
and
population < (select population from world where name='Poland')  
【SQL】9.SQLZOO练习4--SELECT from SELECT Tutorial_第5张图片
5
select name,concat(round(population*100/(select population from world 
where name='Germany' ) ,0),'%') from world 
where continent='Europe'
【SQL】9.SQLZOO练习4--SELECT from SELECT Tutorial_第6张图片
讲解
【SQL】9.SQLZOO练习4--SELECT from SELECT Tutorial_第7张图片
6
select name from world
where gdp > (select max(gdp) from world 
where continent='Europe')
【SQL】9.SQLZOO练习4--SELECT from SELECT Tutorial_第8张图片
7
select continent,name,area from world x
where area >= ALL
(select area from world y
where y.continent=x.continent
and area >0)
【SQL】9.SQLZOO练习4--SELECT from SELECT Tutorial_第9张图片
8
SELECT continent, MIN(name) AS name
FROM world 
GROUP BY continent
ORDER by continent
【SQL】9.SQLZOO练习4--SELECT from SELECT Tutorial_第10张图片
9
select name,continent,population from world x
where 25000000>=all
(select population from world y
where y.continent=x.continent)
【SQL】9.SQLZOO练习4--SELECT from SELECT Tutorial_第11张图片
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)

你可能感兴趣的:(【SQL】9.SQLZOO练习4--SELECT from SELECT Tutorial)