题解 | 播放量峰值top3高的视频

播放量峰值top3高的视频

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

with t as(
    select cid,start_time as timeu,1 as flag
    from play_record_tb
    union all
    select cid,end_time as timeu,-1 as flag
    from play_record_tb
),

uv as (
    select
    cid,timeu,sum(flag) over(partition by cid order by timeu,flag desc) as time_uv
    from t
)

select
cid,max(time_uv) as max_peak_uv
from uv
group by cid
order by max_peak_uv desc
limit 3;

全部评论

相关推荐

熬夜冠军🏆:和你情况差不多,你这个HR算敞亮了,直白告诉你了,不浪费你时间,我的那个还跟我说没法说,只能等。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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