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

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

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

-- 每天 日活数 新用户 占比
select dt,count(distinct uid) dau,
round(count(distinct case when min_date = dt then uid else null end)/count(distinct uid),2) uv_new_ratio
from 
(select uid,date(in_time) dt, min(date(in_time)) over (partition by uid) min_date
from tb_user_log
union all 
select uid,date(out_time) dt, min(date(in_time)) over (partition by uid) min_date
from tb_user_log) u 
group by dt

全部评论

相关推荐

不多说了,看图吧
MomonKa:实际上是,机房机器有些高度,问问你身高,有没有女朋友是看你能不能猛猛加班
你最讨厌面试问你什么?
点赞 评论 收藏
分享
07-28 00:10
已编辑
门头沟学院 算法工程师
码农索隆:这哥们库库在我帖子下评论
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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