题解 | #得分不小于平均分的最低分#

得分不小于平均分的最低分

https://www.nowcoder.com/practice/3de23f1204694e74b7deef08922805b2

计算不得小于平均分的最低分数,要点就在于如何将分数与平均分做比较,此处比较推荐在where字句中进行条件判断,虽然在where子句中使用select查询会降低查询效率,但只要数据量不大,也是可以使用的。

select 
min(e1.score) min_score_over_avg 
from exam_record e1 join examination_info e2 
on e1.exam_id=e2.exam_id 
where tag='SQL' and e1.score >= (select avg(score) from exam_record e3 join examination_info e4 on e3.exam_id=e4.exam_id where e4.tag="SQL");
全部评论

相关推荐

点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
06-11 13:34
offe从四面八方来:我真的没时间陪你闹了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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