题解 | #得分不小于平均分的最低分#
得分不小于平均分的最低分
https://www.nowcoder.com/practice/3de23f1204694e74b7deef08922805b2
select b.score from ( select a.score, sum(a.score) over () / count(1) over () as avg from exam_record a join examination_info b on a.exam_id = b.exam_id and b.tag = "SQL" and a.submit_time is not null and a.score is not null ) b where b.score >= avg order by b.score - avg limit 1
“不小于”这里注意下,第一次提交这里我没注意到......
没想到什么更好的方案,只能偷懒开个窗
全连接应该也可以,就是要多写一些条件