题解 | #得分不小于平均分的最低分#
得分不小于平均分的最低分
http://www.nowcoder.com/practice/3de23f1204694e74b7deef08922805b2
select
min(e_r.score) as min_score_over_avg
from
exam_record e_r
join examination_info e_i on e_r.exam_id = e_i.exam_id
where
e_i.tag = 'SQL'
and score >= (
# 子查询查询出分数不为NULL也就是有效分数的平均分
select
avg(e1.score)
from
exam_record e1
join examination_info e2 on e1.exam_id = e2.exam_id
where
tag = 'SQL'
and e1.score is not null
)