题解 | 平均播放进度大于60%的视频类别

平均播放进度大于60%的视频类别

https://www.nowcoder.com/practice/c60242566ad94bc29959de0cdc6d95ef

with t1 as (
    select tbv.video_id as video_id,tbv.tag as tag, sum(least(time_to_sec(timediff((time(tbu.end_time)),time((tbu.start_time)))),tbv.duration))/(count(*)*tbv.duration) as rate
    from tb_video_info tbv left join tb_user_video_log tbu on tbv.video_id=tbu.video_id
    group by tbv.video_id
    having rate>0.6

)



select t1.tag as tag, concat(round(avg(t1.rate)*100,2),'%') as avg_play_progress
from t1
group by t1.tag
order by avg_play_progress desc

全部评论

相关推荐

09-13 17:25
亲切的00后在笔试:我也遇到了,所以我早他一步查看图片
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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