select min(t.score) as min_score_over_avg from( select ed.exam_id,score, avg(score)over(partition by exam_id) as pg from exam_record ed left join examination_info ef on ed.exam_id=ef.exam_id where ef.tag="SQL" ) as t where t.score>=t.pg
select min(t.score) as min_score_over_avg from( select ed.exam_id,score, avg(score)over(partition by exam_id) as pg from exam_record ed left join examination_info ef on ed.exam_id=ef.exam_id where ef.tag="SQL" ) as t where t.score>=t.pg