select
    level,
    count(distinct t1.uid) as level_cnt
from
    exam_record t1
    left join examination_info t2 on t1.exam_id = t2.exam_id
    left join user_info t3 on t1.uid = t3.uid
where
    tag = "SQL"
    and score > 80
group by
    level
order by level_cnt desc, level desc