题解 | #每个题目和每份试卷被作答的人数和次数#

每个题目和每份试卷被作答的人数和次数

https://www.nowcoder.com/practice/203d0aed8928429a8978185d9a03babc

select 
    tid,
    uv,
    pv
from
    (select
        1 as exam,
        t1.exam_id as tid,
        count(distinct t1.uid) as uv,
        count(t1.exam_id) as pv
    from
        exam_record t1
    group by
        t1.exam_id
    union all
    select
        2 as exam,
        t2.question_id as tid,
        count(distinct t2.uid) as uv,
        count(t2.question_id) as pv
    from
        practice_record t2
    group by
        t2.question_id) t
order by
    t.exam asc,t.uv desc,t.pv desc

全部评论

相关推荐

10-30 16:31
重庆大学 Java
代码飞升_不回私信人...:你说你善于学习,大家都会说。你说你是985,985会替你表达一切
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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