题解 | #各个视频的平均完播率#

各个视频的平均完播率

https://www.nowcoder.com/practice/96263162f69a48df9d84a93c71045753

select video_id,round(avg(rate),3) as avg_comp_play_rate from
(select video_id,if(times>=duration,1,0) as rate from
    (select l.id,l.uid,l.video_id,(l.end_time-l.start_time) as times,
        i.duration from tb_user_video_log l join tb_video_info i 
            on l.video_id = i.video_id where left(l.start_time,4) = '2021') t) p group by video_id order by avg_comp_play_rate desc;

一道题写了15分钟....我才是废物

全部评论

相关推荐

头像
11-07 01:12
重庆大学 Java
精致的小松鼠人狠话不多:签哪了哥
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务