SQL初级问题

来源:百度知道 编辑:UC知道 时间:2024/07/02 02:25:03
现在有一张表:bbc(countryName, region, area, population, gdp)

问题是:For each region show the region and number of countries with populations of at least 10 million.

我写的答案是:
select region,count(population>=10000000) from bbc group by region
但是提示说有错误,我不知道哪里出错了,求教~
select region,count(countryName) from bbc group by region having population>10000000
这么写也错,求教啦

要求是找出每个地区人数大於10M的城市数目

select region,count(countryName) from bbc
where population>=10000000
group by region

写 count(population>=10000000)
count这种语句的时候最好不要跟上其他字段

select count(countryName) from bbc group by region having population>10000000

select count(population>=10000000) from bbc group by region

不知道不是这个问题你试试看

确认population 这个字段是不是都是数字,如果不是数字或者为null都会出错