题解 | 2021年11月每天新用户的次日留存率

2021年11月每天新用户的次日留存率

https://www.nowcoder.com/practice/1fc0e75f07434ef5ba4f1fb2aa83a450

with t1 as(
    SELECT
        uid,
        in_time event_time
    from tb_user_log
    union all
    select
        uid,
        out_time event_time
    from tb_user_log
)
select first_open,
        round(count(distinct s2.uid)/nullif(count(distinct s1.uid),0),2) uv_left_rate
from (select uid,min(date(event_time)) first_open from t1 group by 1) s1
left join t1 s2
on s1.uid = s2.uid and datediff(s2.event_time,s1.first_open) >= 1
where date_format(first_open,'%y-%m') = '21-11'
group by 1
order by 1

eezz

全部评论

相关推荐

2025-12-17 15:08
赤峰学院 Java
乐邦詹雨:学历厂,另外东子不同部门待遇进的难度天差地别,我同学零售一面1h30min有八股算法项目拷打,我就两轮技术面各30min就一面问了些技术问题,二面问了两个开放式技术问题,三面线下hr面就结束了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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