SELECT ei.exam_id exam_id, COUNT(DISTINCT ui.uid) uv, ROUND(AVG(er.score), 1) avg_score FROM user_info ui INNER JOIN exam_record er ON ui.uid = er.uid INNER JOIN examination_info ei ON er.exam_id = ei.exam_id WHERE ei.tag = 'SQL' AND ui.level > 5 AND DATE(er.submit_time) = DATE(ei.release_time) GROUP BY ei.exam_id ORDER BY uv DESC, avg_score;