select university ,
count(*) as total_cnt,
count(gender='male' or null) as male_cnt,
count(gender='female' or null) as female_cnt,
count(age<23 or null) as lt23_cnt
from user_profile
group by university
having avg(gpa)>3.6 and total_cnt>2;

京公网安备 11010502036488号