# 解法一(常规思路) select count(1) as male_num, round(avg(gpa), 1) as avg_gpa from user_profile where gender = 'male'; # 解法二(条件聚合) select count(case when gender= 'male' then 1 else null end) as male_num, round(avg(case when gender= 'male' then gpa else null end), 1) as avg_gpa from user_profile;