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

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

 1、连接两表查询所有视频的播放时长,
2、根据播放进度定义输出每个视频的播放进度作为临时表
3、在临时表中查询分类视频的平均播放进度,并输出所有大于60的
4、因为带有%无法比较大小,所以这里再将上述表中的输出数据用%连接得到答案
 with t2 as (select tag,case when playtime >= duration then 100
           else playtime*100/duration
           end as progress
from (
select a.video_id,tag,duration,timestampdiff(second,start_time,end_time) as playtime
from tb_user_video_log a
join tb_video_info b
on a.video_id = b.video_id) t1)
select tag,concat(avg_play_progress,'%')
from (
select tag,round(avg(progress),2) as avg_play_progress
from t2
group by tag
having avg_play_progress > 60) t3
order by avg_play_progress desc


全部评论

相关推荐

小浪_Coding:找硬件测试,也可兼顾软测欧, 简历还可以的 ,注意排版,项目写的有条理一点, 然后个人技能多加点, 润色好简历之后就开始沟通海投了,深圳,东莞这边做硬件相关的公司还不少, 医疗类,仪器类的都可以尝试
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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