题解 | #浙大不同难度题目的正确率#

浙大不同难度题目的正确率

https://www.nowcoder.com/practice/d8a4f7b1ded04948b5435a45f03ead8c

select
    difficult_level,
    sum(
        case
            when result = 'right' then 1
            else 0
        end
    ) / count(1) as correct_rate
from
    (
        select
            t2.difficult_level,
            t1.result
        from
            (
                select
                    device_id,
                    question_id,
                    result
                from
                    question_practice_detail
                where
                    device_id in (
                        select
                            device_id
                        from
                            user_profile
                        where
                            university = '浙江大学'
                    )
            ) t1
            join (
                select
                    question_id,
                    difficult_level
                from
                    question_detail
            ) t2 on t1.question_id = t2.question_id
    ) t
group by
    difficult_level
order by
    correct_rate;

#一步一步分析,然后组合代码#
全部评论

相关推荐

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