题解 | #试卷发布当天作答人数和平均分#
试卷发布当天作答人数和平均分
http://www.nowcoder.com/practice/5b58e89556dc4153a79d8cf8c08ba499
select
i.exam_id
,r.uid
,r.score
from examination_info i join exam_record r using(exam_id)
where i.tag='SQL' and substr(i.release_time,1,10)=substr(r.start_time,1,10)
)
select
t1.exam_id
,count(distinct t1.uid) as uv
,round(avg(t1.score),1) as avg_score
from user_info u join t1 using(uid)
where u.level>5
group by t1.exam_id
order by uv DESC
,avg_score