select exam_id,
       count(distinct uid) as uv,
       round(avg(score),1) as avg_score
from exam_record
where (exam_id,date(start_time)) in (
    select exam_id,date(release_time)
    from examination_info
    where tag = 'SQL' 
)
and uid in(
    select uid 
    from user_info
    where level > 5
)

group by exam_id
order by uv desc,avg_score asc
#现在做这些题都是对一半多,总有关键的地方想不到