题解 | #计算男生人数以及平均GPA#
计算男生人数以及平均GPA
https://www.nowcoder.com/practice/7d9a7b2d6b4241dbb5e5066d7549ca01
select count(gender) as male_num, round(avg(gpa),1) as avg_gpa from user_profile where gender = "male";
这道题真触碰到知识盲区了,多亏看了眼题解。
count():统计总数
avg():求平均数
round(num,1):保留一位,四舍五入。