id is the poster's unique ID. To get post count per member, group by id to partition by id, and count(name) counts number of names in each partition.
正确答案是:A: select id, count(name) from t1 group by id;
专业分析:
- 选项A:`select id, count(name) from t1 group by id;` 这条语句的作用是按id分组,然后统计每个id对应的帖子数量。它能够正确地显示每个成员发布的帖子数量。
- 选项B:`select id, count(name) from t1 group by id having count(name) > 5;` 这条语句在分组后增加了一个条件,即只有发布帖子数量超过5的成员才会被显示出来。虽然这也是一种统计方式,但它并不符合题目要求的“显示每个成员发布的帖子数量”。
- 选项C:`select id, count(name) from t1 group by id having count(name) > 5 order by count(name);` 这条语句不仅增加了一个条件,还对结果进行了排序。与选项B一样,它并不符合题目要求的“显示每个成员发布的帖子数量”。
- 选项D:`select id, count(name) from t1 where id > 100 group by id;` 这条语句在分组前增加了一个条件,即只有id大于100的成员才会被统计。这也不符合题目要求的“显示每个成员发布的帖子数量”。
因此,最符合题目要求的选项是A。