SQLZOO SUM and COUNT
来源:互联网 发布:php调用淘宝api接口 编辑:程序博客网 时间:2024/05/17 19:59
1:展示世界的總人口。
SELECT SUM(population) FROM world;
2:列出所有的洲份, 每個只有一次。
SELECT DISTINCT continent FROM world;
3:找出非洲(Africa)的GDP總和。
SELECT SUM(gdp) FROM world WHERE continent = 'Africa';
4:有多少個國家具有至少百萬(1000000)的面積。
SELECT COUNT(name) FROM world WHERE area>=1000000;
5:('France','Germany','Spain')(“法國”,“德國”,“西班牙”)的總人口是多少?
SELECT SUM(population) FROM world WHERE name IN ('France','Germany','Spain');
6:For each continent show the continent and number of countries.
SELECT continent,COUNT(name) FROM world GROUP BY continent;
7:For each continent show the continent and number of countries with populations of at least 10 million.
SELECT continent , COUNT(name) FROM world WHERE population >=10000000 GROUP BY continent;
8:List the continents that have a total population of at least 100 million.
SELECT continent FROM world x
WHERE (SELECT SUM(population) FROM world y WHERE y.continent=x.continent)
GROUP BY continent
HAVING SUM(population)>=100000000;
总结
GROUP BY和HAVING功能
HAVING功能可以在GROUP BY排完的结果后进行筛选,如上面的第8例。
- SQLZOO SUM and COUNT
- SQLZOO(SUM and COUNT)Writeup
- sqlzoo练习答案--SUM and COUNT
- sqlzoo练习答案--SUM and COUNT
- SQLZOO习题答案 The nobel table can be used to practice more SUM and COUNT functions./zh
- “Count Primes” and "Range Sum Query - Immutable"
- sqlzoo
- //使用hibernate,实现group by and sum and count
- leetcode_c++:Divide and Conquer:Count of Range Sum(327)
- 327. Count of Range Sum(Divide and Conquer)
- 327. Count of Range Sum(divide and conquer)
- count(1) and count(*)
- SUM/COUNT关键词
- MySQL COUNT SUM
- Count of Range Sum
- sql sum count if
- mysql sum Count AVG
- The nobel table can be used to practice more SUM and COUNT functions.
- 工厂模式、单例模式、注册树模式
- gulp使用总结(不加return后果很严重)
- 图解 Android 事件分发机制
- solr的安装步骤
- eclipse第一次建server
- SQLZOO SUM and COUNT
- 计算字符个数
- Fisher Vector费舍尔向量and FIsher Kernel费舍尔核
- SQL游标
- 玲珑oj 1072 - Capture
- 在Kettle里使用参照表进行数据校验(流查询实现)
- windows service 安装与下载命令
- 学习封装mvc框架(七)配置加载类
- php 功能函数应用