统计查询

1.有多少个不同的省?
select count(distinct province) from kg_fk_city ---2
2. 每个城市的数目
select city,count(city) from kg_fk_city group by city
changpin 3
chaoyang 6
haidian 3
lvliang 5
yuncheng 3
3. 城市数目大于5的城市
select city,count(city) as count_city from kg_fk_city group by city having count_city>5
chaoyang 6
posted on 2019-06-17 09:46 happygril3 阅读(95) 评论(0) 收藏 举报
浙公网安备 33010602011771号