标签:
List the continents that have a total population of at least 100 million.
select continent from world group by continent having sum(population)>=100000000
这题考察的是使用集聚函数生成表之后,如何过滤
一般我们生成一个查询结果集都会使用 where 表达式来过滤不想要的内容,
但是group by分组表达式在SQL中是在where过滤之后才能执行,所以当group by分组之后,我们需要另外一个表达式having
来过滤分组聚集后的结果集
having sum(population)>=100000000
continent |
---|
Africa |
Asia |
Caribbean |
Eurasia |
Europe |
North America |
Oceania |
South America |
标签:
原文地址:http://www.cnblogs.com/winters1992/p/5814287.html