select min(t1.score) as min_score_over_avg from exam_record as t1 join examination_info as t2 on t1.exam_id = t2.exam_id where t2.tag = 'SQL' and t1.score >= (select avg(t1.score) from exam_record as t1 join examination_info as t2 on t1.exam_id = t2.exam_id where t2.tag = 'SQL' )
1.以t1.exam_id = t2.examm_id为桥梁将两个表连接起来成为新表,
2.以t2.tag = 'SQL‘为条件筛选SQL试卷的记录。
3.用avg(t1.score)函数求出所有SQL试卷的平均分。
4.在新表中以t2.tag = 'SQL' 和t1.score >= 平均分 为条件筛选出SQL试卷的得分不小于平均分的所有记录。
5.用min(t1.score)函数求出这些记录中得分最低的那个分数