题解 | #试卷发布当天作答人数和平均分#

试卷发布当天作答人数和平均分

https://www.nowcoder.com/practice/5b58e89556dc4153a79d8cf8c08ba499

select 
    t1.exam_id,
    count(distinct t1.uid) uv,
    round(avg(score),1) avg_score
from exam_record t1
inner join (
    select * 
    from user_info
    where level > 5
) t2
on t1.uid = t2.uid
inner join (
    select * 
    from examination_info
    where tag = 'SQL'
) t3
on t1.exam_id = t3.exam_id
group by t1.exam_id
order by uv desc, avg_score;

全部评论

相关推荐

评论
1
收藏
分享
牛客网
牛客企业服务