题解 | 计算男生人数以及平均GPA
计算男生人数以及平均GPA
https://www.nowcoder.com/practice/7d9a7b2d6b4241dbb5e5066d7549ca01
select count(*) as male_num,round(avg(gpa),1) as avg_gpa from user_profile where gender='male'
题目分析:‘男性用户’选择gender,‘人数’用count函数,‘平均GPA’用avg函数,‘保留一位小数’用rount,结合起来就是rount(avg(*),1),在根据输出示例,要改表头名用as。
#计算男生人数以及平均GPA#