select uid, round(avg(score),0) as avg_score, round(avg(time),1) as avg_time_took from (select er.uid, ei.exam_id, (case when er.score is not null then er.score else 0 end ) as score, (case when er.submit_time is not null then timestampdiff(minute,start_time, submit_time) else ei.duration end ) as t...