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

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

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

with after_release_time as (
    select uid, exam_id, submit_time, score
    from exam_record
    left join examination_info using (exam_id)
    where tag = 'SQL' 
    and date_format(start_time, '%Y%m%d') = date_format(release_time, '%Y%m%d')
    and start_time > release_time
),
    above_level_5 as (
    select uid
    from user_info where level > 5
)
    select exam_id, count(distinct uid) as uv, 
        round(sum(ifnull(score, 0))/ count(uid), 1) as avg_score
    from after_release_time
    where uid in (select uid from above_level_5)
    and submit_time is not null
    group by exam_id
    order by uv desc, avg_score

全部评论

相关推荐

不愿透露姓名的神秘牛友
06-26 18:18
点赞 评论 收藏
分享
认真搞学习:28小登的建议,投算法岗不要写什么物理竞赛,互联网+,多写点项目,用什么算法做了什么。还有本科算法是不可能的开发你这个也没有项目啊
点赞 评论 收藏
分享
Twilight_mu:经典我朋友XXXX起手,这是那种经典的不知道目前行情搁那儿胡编乱造瞎指导的中年人,不用理这种**
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务