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

各个视频的平均完播率

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


select distinct t1.video_id
,round((count(if (t1.jiange >=t1.duration,1,null)) over(partition by t1.video_id))/(count(*) over(partition by t1.video_id)),3) as cnt_all from (
select u.video_id
,TIMESTAMPDIFF(second,u.start_time,u.end_time) as jiange
,v.duration 
from tb_user_video_log as u left join tb_video_info as v 
on u.video_id=v.video_id where year(u.start_time)=2021) t1 
order by cnt_all desc


全部评论

相关推荐

头顶尖尖的程序员:我也是面了三四次才放平心态的。准备好自我介绍,不一定要背熟,可以记事本写下来读。全程控制语速,所有问题都先思考几秒,不要急着答,不要打断面试官说话。
点赞 评论 收藏
分享
07-07 12:25
门头沟学院 Java
程序员牛肉:你这个智邮公司做的就是那个乐山市税务系统的服务吗?
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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