sqlzoo答案-4 SELECT IN SELECT

这篇博客介绍了如何在SQLZoo练习中使用SELECT IN SELECT语句来解决问题,重点讨论了排序与CONCAT函数的应用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  1. SELECT name FROM world WHERE population > ( select population from world where name = 'russia');

  2. SELECT name FROM world where continent = 'Europe' AND gdp/population > ( select gdp/population from world where name = 'United Kingdom');

  3. SELECT name, continent FROM world WHERE continent in (select continent from world where name = 'Argentina' or name ='Australia') order by name;
    排序用 order by

  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/(select population from world where name = 'Germany')*100 ),'%') AS population FROM world where continent = 'Europe';
    CONCAT函数

  6. SELECT name FROM world WHERE gdp > ALL(select gdp from world where continent = 'Europe' and gdp>0);

  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,name FROM world x WHERE x.name = (select name from world y where y.continent = x.continent order by name limit 1)

  9. SELECT name, continent, population FROM world x WHERE 25000000 >= all (select population from world y where y.continent = x.continent and 0 < population);

  10. SELECT name, continent FROM world x WHERE population/3 >= ALL (select population from world y where y.continent = x.continent and population > 0 and y.name != x.name )

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值