# 使用子查询,运行时间35ms占用内存6664KB
# select *
# from
#     (
#         select
#             university,
#             avg(question_cnt) avg_question_cnt,
#             avg(answer_cnt) avg_answer_cnt
#         from
#             user_profile
#         group by
#             university
#     )a
# where a.avg_question_cnt < 5 
# or a.avg_answer_cnt < 20

# 使用group by having,运行时间33ms,占用内存6680KB
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