题解 | #试卷发布当天作答人数和平均分#
试卷发布当天作答人数和平均分
https://www.nowcoder.com/practice/5b58e89556dc4153a79d8cf8c08ba499
select exam_id,
count(distinct uid) as uv,
round(avg(score),1) as avg_score
from exam_record
where(uid,exam_id) in
(select uid,
exam_id
from exam_record
join examination_info using(exam_id)
join user_info using(uid)
where submit_time is not null and date(release_time)=date(submit_time) and level>5)
group by exam_id
order by uv desc,avg_score asc;