题解 | #SQL类别高难度试卷得分的截断平均值#

SQL类别高难度试卷得分的截断平均值

https://www.nowcoder.com/practice/a690f76a718242fd80757115d305be45

# 1.以exam_record为主表,联表,让tag,difficulty,score在一起
# 2.where筛选条件:tag = sql and difficuty = hard
# 3.计算阶段截断平均值:= (sum(score) - max(score) - min(score) ) / count(score) - 2, 取前两位小数点
# 注意点:题目求的是所有用户-->无需根据用户分组,虽然group by 经常和聚合函数一起用,但是对于整个表进行聚合的时候,就不需要用到group by

select tag,difficulty,
round((sum(score) - max(score) - min(score) ) / (count(score) - 2),1) as clip_avg_score
from exam_record
left join examination_info
on exam_record.exam_id = examination_info.exam_id
where examination_info.tag = 'SQL' and examination_info.difficulty = 'hard'

全部评论

相关推荐

小叮当411:应该是1-3个月吧
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
07-11 11:16
点赞 评论 收藏
分享
程序员小白条:你是沟通了900个,不是投了900份简历,你能投900份,意味着对面都要回复你900次,你早就找到实习了,没亮点就是这样的,别局限地区,时间投的也要早,现在都要7月了
点赞 评论 收藏
分享
评论
点赞
1
分享

创作者周榜

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