题解 | #统计每天刷题数超过5的user_id以及刷题数#

统计每天刷题数超过5的user_id以及刷题数

https://www.nowcoder.com/practice/852a14b888c448f1a26f0e2e20f668a7

#分组列称之为"聚合列",其他称之为"非聚合列"。非聚合列必须涉及函数否则报错

#select `date`, `user_id`, sum(pass_count) as total_pass_count from questions_pass_record_detail where pass_count>5 group by date

#没注意用where和having的区别
#select `date`, `user_id`, sum(pass_count) as total_pass_count from questions_pass_record_detail where pass_count>5 group by date,user_id 

select `date`, `user_id`, sum(pass_count) as total_pass_count from questions_pass_record_detail group by date,user_id having total_pass_count>5

全部评论
#group by后面有两个字段,输出列的行数还是根据第一个字段来的
点赞 回复 分享
发布于 2024-07-11 12:05 广东

相关推荐

牛至超人:把哈工大,再加大加粗,看见闪闪发光的哈工大字样,面试官直接流口水
投递字节跳动等公司10个岗位
点赞 评论 收藏
分享
迷茫的大四🐶:看来已经准备换人了
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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