题解 | #每天的日活数及新用户占比#

每天的日活数及新用户占比

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

--求出每日新增用户
with new_user as(
    select uid,date(min(in_time)) dt
    from tb_user_log
    group by uid
),
-- 求出全部用户信息
all_user_log as(
    select uid,date(in_time) dt
    from tb_user_log
    union
    select uid,date(out_time)
    from tb_user_log
)
select all_user_log.dt dt,
       count(all_user_log.uid) dau,
       round(count(new_user.uid)/count(all_user_log.uid),2) uv_new_ratio  
from new_user
right join all_user_log
on new_user.uid=all_user_log.uid
and new_user.dt=all_user_log.dt
group by all_user_log.dt
order by all_user_log.dt

全部评论

相关推荐

05-13 00:41
已编辑
北京邮电大学 Java
理性的杰克刷牛客:ai肯定要有的,最好学一下agent方向加一个智能客服什么的进去,并且多加点什么skill,mcp啥的,另外你现在的项目深度有些浅,这些功能都太简单了,而且也不是真正能扛高并发的实现,没有什么太大的亮点,可以去网上找点更有深度的项目。可以先投一些中小厂,有实习经历以后再去大厂,你现在这个大厂可能机会不大
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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