题解 | #分组过滤练习题#
分组过滤练习题
http://www.nowcoder.com/practice/ddbcedcd9600403296038ee44a172f2d
*1.根据学校分组 2.求平均发帖数/回帖数
聚合函数作为结果筛选条件,不能用where,要用having
select university,avg(question_cnt) as avg_question_cnt,avg(answer_cnt) as avg_answer_cnt from user_profile group by university having avg_question_cnt < 5&nbs***bsp;avg_answer_cnt < 20