我有一个包含以下数据的表格:
+----+-----------------+
| id | country |
+----+-----------------+
| 1 | i'm from usa |
| 2 | i'm from italy |
| 3 | i'm from china |
| 4 | i'm from india |
| 5 | she's from usa |
| 6 | he's from china |
+----+-----------------+
我想通过检查列中的国家名称来了解每个国家的人口country
。我想要这样的东西:
+---------+------------+
| country | population |
+---------+------------+
| usa | 2 |
| italy | 1 |
| china | 2 |
| india | 1 |
+---------+------------+
我想我应该使用GROUP BY
和COUNT()
功能。但是如何?谢谢。