题解 | #计算男生人数以及平均GPA#
计算男生人数以及平均GPA
http://www.nowcoder.com/practice/7d9a7b2d6b4241dbb5e5066d7549ca01
两种方法都能求出结果,但是显然第二种更简洁。
-- SELECT sum(gender="male") male_num, ROUND(AVG(gpa), 1) avg_gpa FROM user_profile where gender="male";
SELECT COUNT(gender) male_num, ROUND(AVG(gpa), 1) avg_gpa FROM user_profile where gender="male";
网易游戏公司福利 555人发布