select tag, difficulty, round(avg(score), 1)as clip_avg_score
from exam_record t1 join examination_info t2 using(exam_id)
where tag ='SQL' and difficulty = 'hard'
 and score not in (SELECT MAX(score) FROM exam_record) and 
 score not in (SELECT min(score) FROM exam_record)
 group by tag