题解 | #计算男生人数以及平均GPA#

计算男生人数以及平均GPA

https://www.nowcoder.com/practice/7d9a7b2d6b4241dbb5e5066d7549ca01

select count(gender) as male_num, avg(gpa) as avg_gpa
from user_profile
where gender = 'male'

本题中仍然考察了聚合函数的用法。count函数仅仅是查询一共有多少的记录,包含null的记录。关键字where将结果框定在男性中,count函数和avg函数也在框定的范围内进行计算。

全部评论

相关推荐

评论
点赞
1
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务