SUM and COUNT

注意:where语句中对表示条件的需要用单引号, 下面的译文使用的是有道翻译如有不正确,请直接投诉有道

01.Show the total population of the world.

译文:展示世界总人口。

SELECT SUM(population) FROM world

02.List all the continents - just once each.

译文:列出所有的大陆——每个大陆只列出一次。

SELECT DISTINCT continent FROM world

03.Give the total GDP of Africa

译文:看看非洲的GDP总量

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

04.How many countries have an area of at least 1000000

译文:有多少国家的面积至少有100万。

SELECT COUNT(name) FROM world WHERE area >= 1000000

05.What is the total population of ('Estonia', 'Latvia', 'Lithuania')

译文:爱沙尼亚、拉脱维亚、立陶宛的总人口是多少?

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

06.For each continent show the continent and number of countries.

译文:表示每个洲的洲数和国家数。

SELECT continent, COUNT(name) FROM world GROUP BY continent

07.For each continent show the continent and number of countries with populations of at least 10 million.

译文:每一洲显示人口至少为1 000万的洲和国家数目。

SELECT continent, COUNT(name) FROM world WHERE population > 10000000 GROUP BY continent

08.List the continents that have a total population of at least 100 million.

译文:列出总人口至少为1亿的大洲。

SELECT continent FROM world GROUP BY continent HAVING SUM(population) >= 100000000

练习网址:https://sqlzoo.net/wiki/SUM_and_COUNT

------------------------------------------------------------------------------------------------------------------------------------------------------------------

最新文章

  1. Python购物车程序
  2. 专业上的常用的工具和类库集 By 老衣
  3. 14-前端开发之CSS
  4. Discrete.Differential.Geometry-An.Applied.Introduction(sig2008)笔记
  5. 用python的BeautifulSoup分析html 【转】
  6. JavaScript中 Promise的学习以及使用
  7. 通过 Mesos、Docker 和 Go,使用 300 行代码创建一个分布式系统
  8. css 多栏自适应布局
  9. JS 事件绑定的几种方式 小笔记
  10. eclipse修改编译路径
  11. 老司机带你开飞机 一: mssql on linux 安装指导
  12. javascript中的数组对象
  13. 利用data属性来存json、和取数据还原json
  14. 使用LinkedList类生成一个集合对象,循环加入“小样1”,“小样2”,“小样3”,“小样4”,“小样5”……“小样100”。输出这个集合的大小。再使用循环删除这个集合中所有名字为偶数的对象,比如“小样6”,“小样100”,都是偶数名。最后:循环输出集合中所有的对象,看是否删除成功。
  15. node.js(基础四)_express基础
  16. iframe无刷新跨域上传文件并获得返回值
  17. java多线程快速入门(十三)
  18. C和C指针小记(十一)-递归和迭代优化
  19. MySQL Error Code文档手册---摘自MySQL官方网站
  20. Ubuntu 16.04配置国内高速apt-get更新源

热门文章

  1. css3支持动画吗?css3可以用于网页动画的展现吗
  2. The Shortest Statement,题解
  3. XHXJ's LIS,还是dp
  4. 不懂SpringApplication生命周期事件?那就等于不会Spring Boot嘛
  5. 数据可视化之powerBI基础(十六)PowerQuery的这个小功能,让你轻松发现数据质量问题
  6. 数据可视化之powerBI基础(十四)Power BI中创建联动切片器
  7. 数据可视化之powerBI技巧(七)从Excel到PowerBI,生成笛卡尔积的几种方式
  8. python之爬虫(九)PyQuery库的使用
  9. day8 python 列表,元组,集合,字典的操作及方法 和 深浅拷贝
  10. DEP(Data Execution Prevention) 数据执行保护