题解 17 | #计算男生人数以及平均GPA#
【分类】:聚合函数、count、avg
分析思路
select 查询结果 [count(性别) as male_num,avg(gpa) as avg_gpa]
from 从哪张表中查找数据 [user_profile]
where 查询条件 [男生]
求解代码
select
count(gender) as male_num,
avg(gpa) as avg_gpa
from user_profile
where gender = 'male'