题解 | #分组过滤练习题#
分组过滤练习题
https://www.nowcoder.com/practice/ddbcedcd9600403296038ee44a172f2d
select university,avg(question_cnt) avg_question_cnt,avg(answer_cnt) avg_answer_cnt from user_profile group by university having avg(question_cnt) < 5 or avg(answer_cnt) <20
- 先确定分组条件,如题-大学
- 分组后进行筛选(having)符合要求的组(通过平均函数)
- 确定需要查询的列
- 检查语法格式