美文网首页
【SQL】9.SQLZOO练习4--SELECT from SE

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

作者: 一曈 | 来源:发表于2017-06-05 13:18 被阅读97次

题目链接: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)

相关文章

网友评论

      本文标题:【SQL】9.SQLZOO练习4--SELECT from SE

      本文链接:https://www.haomeiwen.com/subject/szuifxtx.html