题解 | #近一个月发布的视频中热度最高的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

全部评论

相关推荐

06-18 08:36
湖南大学 Java
运营你豪哥:没啥拷打的 1.增加量化结果,现在有点缺效果数据 2.突出复杂性,现在的项目描述有点像功能清单,强调一下技术难点和解决方案。
不给转正的实习,你还去吗
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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