题解 | #分组过滤练习题#
分组过滤练习题
https://www.nowcoder.com/practice/ddbcedcd9600403296038ee44a172f2d
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 or avg_answer_cnt<20 //聚合查询只能使用having 再查询AVg平均对象
查看5道真题和解析