题解 | #近一个月发布的视频中热度最高的top3视频#

近一个月发布的视频中热度最高的top3视频

https://www.nowcoder.com/practice/0226c7b2541c41e59c3b8aec588b09ff

select
b.video_id,
round((100*(sum(b.if_ok)/count(1))+5*sum(b.if_like)+3*count(b.comment_id)
+2*sum(b.if_retweet))/(min(b.near_day)+1)) as hot_index
from
(
select
tuvl.video_id,
if(timestampdiff(second,tuvl.start_time,tuvl.end_time)>=a.duration,1,0) if_ok,
tuvl.if_like,
tuvl.if_retweet,
tuvl.comment_id,
timestampdiff(day,date(tuvl.end_time),
(select date(max(end_time)) from tb_user_video_log)) near_day
from tb_user_video_log tuvl 
inner join
(
select 
video_id,
duration
from tb_video_info 
where timestampdiff(day,date(release_time),
(select date(max(end_time)) from tb_user_video_log))<=29
) a on tuvl.video_id=a.video_id
) b
group by b.video_id
order by hot_index desc
limit 3

全部评论

相关推荐

不愿透露姓名的神秘牛友
11-27 10:52
点赞 评论 收藏
分享
11-24 00:11
已编辑
广东工业大学 算法工程师
避雷深圳&nbsp;&nbsp;yidao,试用期&nbsp;6&nbsp;个月。好嘛,试用期还没结束,就直接告诉你尽快找下一家吧,我谢谢您嘞
牛客75408465号:笑死,直属领导和 hr 口径都没统一,各自说了一些离谱的被裁理由,你们能不能认真一点呀,哈哈哈哈哈😅😅😅
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务