【SQL】10.SQLZOO练习5--SUM and COUNT

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

【SQL】10.SQLZOO练习5--SUM and COUNT_第1张图片
1
SELECT SUM(population) FROM world
【SQL】10.SQLZOO练习5--SUM and COUNT_第2张图片
2
select distinct continent from world;
【SQL】10.SQLZOO练习5--SUM and COUNT_第3张图片
3
select sum(gdp) from world
where continent='Africa';
【SQL】10.SQLZOO练习5--SUM and COUNT_第4张图片
4
select count(name) from world
where area >= 1000000;
【SQL】10.SQLZOO练习5--SUM and COUNT_第5张图片
5
select sum(population) from world 
where name in ('Estonia', 'Latvia', 'Lithuania')
【SQL】10.SQLZOO练习5--SUM and COUNT_第6张图片
6
select continent ,count(name) from world
group by continent;
【SQL】10.SQLZOO练习5--SUM and COUNT_第7张图片
7
select continent,count(name) from world
where population >= 10000000
group by continent;
【SQL】10.SQLZOO练习5--SUM and COUNT_第8张图片
8
select continent from world
group by continent 
having sum(population) >= 100000000;

你可能感兴趣的:(【SQL】10.SQLZOO练习5--SUM and COUNT)