题解 | #得分不小于平均分的最低分#
得分不小于平均分的最低分
https://www.nowcoder.com/practice/3de23f1204694e74b7deef08922805b2
select score min_score_over_avg from exam_record er left join examination_info ei on er.exam_id=ei.exam_id where tag='SQL' and score>=(select avg(score) from exam_record where exam_id in (select exam_id from examination_info where tag='SQL')) order by min_score_over_avg limit 1
#思路:
有两张表(所以肯定要联结,考虑left join on),
且第二张表不仅有sql(考虑子嵌套一个select)
只要大于平均分的最低那个分数,因此score>符合要求的平均分+排序,limit 1