select count(gender) as male_num,avg(gpa) as avg_gpa
from user_profile
where gender='male';

select count(gender) as male_num,avg(gpa) as avg_gpa /COUNT(gender) 是聚合函数,统计满足条件的记录数量,AS male_count 为统计的男性用户数量结果列设置别名。AVG(gpa) 是聚合函数,计算 gpa 的平均值,AS avg_gpa 为平均 gpa 结果列设置别名。

from user_profile

where gender='male'; /筛选条件,只选取性别为男性的记录,以便对这些记录进行数量统计和 gpa 平均值计算。