with a as(
select 
tag,
avg(score) as avg_score

from exam_record er
join examination_info ei on er.exam_id =ei.exam_id

group by tag)

select min(score) as min_score_over_avg
from(
select 
ei.tag,score
from exam_record er
join examination_info ei on er.exam_id =ei.exam_id
where score >=(select avg_score from a where tag='SQL')
and tag='SQL')b


分步骤算