SELECT uid, exam_id, round(sum(max_min)/count(max_min),0) avg_new_score FROM ( select exam_id,uid,score,if(min_score=max_score,score,(score - min_score) / (max_score - min_score)*100) max_min from ( SELECT uid, exam_id, score, MIN(score) OVER (PARTITION BY exam_id) AS min_sc...