当前位置:   article > 正文

sqlzoo 5.SUM and COUNT 答案

sqlzoo 5.SUM and COUNT 答案

有什么问题,欢迎评论或私聊。转载请私聊博主,谢谢。

原题链接:https://sqlzoo.net/wiki/SUM_and_COUNT

其他题解连接:https://blog.csdn.net/aiqiyizz/article/details/109057732

题解对应的是英文版题目。

5 SUM and COUNT

5.1 Total world population

SELECT SUM(population)
FROM world
  • 1

5.2 List of continents

SELECT DISTINCT continent
FROM world
  • 1

5.3 GDP of Africa

SELECT SUM(gdp)
FROM world
WHERE continent = 'Africa'
  • 1
  • 2

5.4 Count the big countries

SELECT COUNT(*)
FROM world
WHERE area >= 1000000
  • 1
  • 2

5.5 Baltic states population

SELECT SUM(population)
FROM world
WHERE name IN ('Estonia','Latvia','Lithuania')
  • 1
  • 2

5.6 Counting the countries of each continent

SELECT continent, COUNT(name)
FROM world
GROUP BY continent
  • 1
  • 2

5.7 Counting big countries in each continent

SELECT continent, COUNT(name)
FROM world
WHERE population >= 10000000
GROUP BY continent
  • 1
  • 2
  • 3

5.8 Counting big continents

SELECT continent
FROM world
GROUP BY continent
HAVING SUM(population) >= 100000000
  • 1
  • 2
  • 3
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/954205
推荐阅读
相关标签
  

闽ICP备14008679号