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

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

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

with t1 as
(
select 
video_id,
sum(if(timestampdiff(second,start_time,end_time) >= duration,1,0)) as view_all,
count(start_time) as view_amout,
sum(if_like) as like_amout,
count(comment_id) as comment_amout,
sum(if_retweet) as share_amout,
datediff(date((select max(end_time) from tb_user_video_log)),max(date(end_time))) as no_play_day_cnt
from tb_video_info
join tb_user_video_log using(video_id)
where
    datediff (
        date((select max(end_time) from tb_user_video_log)),
        date(release_time)
    ) <= 29
group by 1
)

select 
video_id,
round((100*(view_all/view_amout)+5*like_amout+3*comment_amout+2*share_amout)/(1+no_play_day_cnt)) as hot_index
from t1
order by 2 desc
limit 3

全部评论

相关推荐

Bug压路:老哥看得出来你是想多展示一些项目,但好像一般最多两个就够了😂页数一般一页,多的也就2页;这些项目应该是比较同质化的,和评论区其他大佬一样,我也觉得应该展示一些最拿手的(质量>数量)😁😁😁专业技能部分也可以稍微精简一些
点赞 评论 收藏
分享
Allen好Iverson:我看牛客都是20-30k的 这个3.9k爆出来有点,哈哈哈哈
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务