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

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

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

方法1:三表左外连接

select
    c.university,
    b.difficult_level,
    count(a.device_id) / count(distinct a.device_id) as avg_answer_cnt
from
    question_practice_detail a
    left join question_detail b on a.question_id = b.question_id
    left join user_profile c on a.device_id = c.device_id
group by
    c.university,
    b.difficult_level

方法2:三表内连接

select
    c.university,
    b.difficult_level,
    count(a.device_id) / count(distinct a.device_id) as avg_answer_cnt
from
    question_practice_detail a,
    question_detail b,
    user_profile c
where a.question_id = b.question_id and a.device_id = c.device_id
group by
    c.university,
    b.difficult_level

全部评论

相关推荐

内向的柠檬精在研究求...:这不才9月吗,26到明年毕业前能一直找啊,能拿下提前批,转正的,offer打牌的都是有两把刷子的,为什么非要跟他们比。如果别人是9本硕+金牌+好几段大厂实习呢?如果别人是双非通天代呢?如果别人是速通哥呢?,做好自己就行了,我们做不到他们一样提前杀死比赛,但晚点到终点也没啥关系吧
双非应该如何逆袭?
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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