mysql中student表中数据如下,查询表中年龄大于18的,不同年龄的人数是多少,正确的查询sql是()
+-----+---------+-------+
| id | name | age |
+-----+---------+-------+
| 1 |tom | 18 |
| 2 |jerry | 20 |
| 3 |xiaoming | 45 |
| 4 |sunwu | 18 |
| 5 |liwen | 18 |
+-----+---------+-------+
SELECT age, count(id) from student GROUP BY age where age>18
SELECT age, count(id) from student GROUP BY age having age>18
SELECT age, sum(*) from student GROUP BY age having age>18
SELECT age, sum(*) from student where age>18 GROUP BY age