题解 | #计算男生人数以及平均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';
刚开始给出的答案是select count(gender) as male_num, avg(gpa) as avg_gpa from user_profile where gender='male';虽然测试结果也通过了,但是看到其他牛油的解答觉得确实少考虑了一个隐含条件,注意保留一位小数,这样结果更完善
查看16道真题和解析