1. 程式人生 > >SQLZOO練習筆記-SUM ANDCOUNT

SQLZOO練習筆記-SUM ANDCOUNT

SELECT SUM(population) FROM world

select distinct continent from world

select sum(gdp) from world where continent = ‘Africa’

select count(distinct name) from world where area >= 1000000

select sum(population) from world where name in (‘Estonia’, ‘Latvia’, ‘Lithuania’)

select continent, count(distinct name) from world group by continent

select continent, count(distinct name) from world where population >= 10000000 group by continent

select continent from (select continent, sum(population) as a from world group by continent) c where a >= 100000000