牛客网SQL157

平均播放进度大于60%的视频类别_牛客题霸_牛客网 

select 类别标签,concat(format(平均播放进度*100,2),'%')
from
(
select 类别标签,sum(播放进度)/count(*) 平均播放进度
from
(
  select 视频id,类别标签,播放时长/视频时长 播放进度
  from
  (
     select a.video_id 视频id,b.tag 类别标签,
     case
     when timestampdiff(second, start_time,end_time)>=b.duration
     then b.duration
     else timestampdiff(second, start_time,end_time)
     end 播放时长,
     b.duration 视频时长
     from tb_user_video_log a join tb_video_info b
     on a.video_id=b.video_id
  ) c
) d
group by 类别标签
order by 平均播放进度 desc
) e
where 平均播放进度>0.6

select 类别标签,concat(format(平均播放进度*100,2),'%')
from
(
select 类别标签,sum(播放进度)/count(*) 平均播放进度
from
(
  select 视频id,类别标签,播放时长/视频时长 播放进度
  from
  (
     select a.video_id 视频id,b.tag 类别标签,
     case
     when timestampdiff(second, start_time,end_time)>=b.duration
     then b.duration
     else timestampdiff(second, start_time,end_time)
     end 播放时长,
     b.duration 视频时长
     from tb_user_video_log a join tb_video_info b
     on a.video_id=b.video_id
  ) c
) d
group by 类别标签
order by 平均播放进度 desc
) e
where 平均播放进度>0.6

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值