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

各个视频的平均完播率

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

SELECT video_id,round(SUM(IF(duration<=dt,1,0))/COUNT(*),3) rate FROM ( SELECT log.video_id,duration,TIMESTAMPDIFF(SECOND,start_time,end_time) dt FROM tb_user_video_log log JOIN tb_video_info info ON log.video_id = info.video_id WHERE YEAR(start_time) = 2021 )t1 GROUP BY video_id ORDER BY rate DESC;

全部评论

相关推荐

藏剑天涯:全要了 领4份工资
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务