题解 | #每个创作者每月的涨粉率及截止当前的总粉丝量#

每个创作者每月的涨粉率及截止当前的总粉丝量

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

with t1 as (select author,
                   substr(end_time, 1, 7)            as mon,
                   count(if(if_follow = 1, 1, null)) as addfensi,
                   count(if(if_follow = 2, 1, null)) as subfensi,
                   count(1)                          as tol
            from tb_user_video_log t1
                     join tb_video_info t2
                          on t1.video_id = t2.video_id
            where substr(end_time, 1, 4) = 2021
            group by substr(end_time, 1, 7), author)
select author,
       mon,
       round((addfensi - subfensi) / tol, 3)  as fans_growth_rate,
       sum(addfensi - subfensi)
           over (partition by author order by mon,addfensi,subfensi  ) as total_fans
from t1 order by author,total_fans;

全部评论

相关推荐

菜菜咪:1. 可以使用简历网站的模版,美观度会更好一点 2. 邮箱可以重新申请一个,或者用qq邮箱的别名,部分hr可能会不喜欢数字邮箱 3. 项目经历最好分点描述,类似的项目很多,可以参考一下别人怎么写的 4. 自我评价可加可不加,技术岗更看重技术。最后,加油,优秀士兵
点赞 评论 收藏
分享
牛客868257804号:九个中铁八个中建
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务