题解 | #牛客直播各科目出勤率#

牛客直播各科目出勤率

https://www.nowcoder.com/practice/0cab547df4f0430b93042128f445d899

select course_id, course_name, round(chuqing * 100 / zong, 2) as 'attend_rate(%)'
from (
    select count(distinct user_id) as chuqing, course_id
    from attend_tb
    where timestampdiff(minute, in_datetime, out_datetime) >= 10
    group by course_id
) a join (
    select count(distinct user_id) as zong, course_id
    from behavior_tb
    where if_sign = 1
    group by course_id
) b using(course_id)
right join course_tb using(course_id)
group by course_id, course_name
order by course_id

全部评论

相关推荐

2025-12-20 13:19
已编辑
曲阜师范大学 Java
点赞 评论 收藏
分享
2025-12-15 12:50
河北工程大学
sta666:我也是这个国际商业化的,三天,一天一面,就通过了,不过我是后端实习生,好好面感觉能过。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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