【SQL】9.SQLZOO練習(xí)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)
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容