题解 | #得分不小于平均分的最低分#
得分不小于平均分的最低分
https://www.nowcoder.com/practice/3de23f1204694e74b7deef08922805b2
# 请从试卷作答记录表中找到SQL试卷得分不小于该类试卷平均得分的用户最低得分。
# SQL试卷、 不小于 、 该类试卷均分、最低分
select min(score)
from exam_record t1
left join examination_info t2
on t1.exam_id = t2.exam_id
where t2.tag = 'SQL'
and score >= (
select avg(score)
from exam_record t1
left join examination_info t2
on t1.exam_id = t2.exam_id
where t2.tag = 'SQL'
)
# SQL试卷、 不小于 、 该类试卷均分、最低分
select min(score)
from exam_record t1
left join examination_info t2
on t1.exam_id = t2.exam_id
where t2.tag = 'SQL'
and score >= (
select avg(score)
from exam_record t1
left join examination_info t2
on t1.exam_id = t2.exam_id
where t2.tag = 'SQL'
)