题解 | 平均活跃天数和月活人数

平均活跃天数和月活人数

https://www.nowcoder.com/practice/9e2fb674b58b4f60ac765b7a37dde1b9

with t0 as(select distinct date_format(start_time,'%Y%m') as month,uid,date_format(submit_time,'%Y-%m-%d') as dt from exam_record where score is not null order by 1)

select month,round(count(dt)/count(distinct case when dt is not null then uid end),2) as avg_active_days,count(distinct case when dt is not null then uid end) as mau from t0 where month like '2021%' group by 1

全部评论

相关推荐

程序员牛肉:你这简历有啥值得拷打的?在牛客你这种简历一抓一大把,也就是个人信息不一样而已。 关键要去找亮点,亮点啊,整个简历都跟流水线生产出来的一样。
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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