题解 | #统计每个学校各难度的用户平均刷题数#

统计每个学校各难度的用户平均刷题数

https://www.nowcoder.com/practice/5400df085a034f88b2e17941ab338ee8

select
    university,
    difficult_level,
    round(
        count(qu.question_id) / count(distinct qu.device_id),4) as avg_answer_cnt
from
    user_profile as us,
    question_practice_detail as qu,
    question_detail as de
where
    us.device_id in (
        select
            qu.device_id
        from
            question_detail
        where
            qu.question_id in (select de.question_id from question_detail ))
group by
    university,
    difficult_level;

发现答案基本都用了表连接,我想尝试一下用多次条件语句进行查询,不知道大佬们有何见解

全部评论

相关推荐

程序员猪皮:看不到八股什么意思
点赞 评论 收藏
分享
评论
3
收藏
分享
牛客网
牛客企业服务