排名

用户解题统计

过去一年提交了

勋章 ①金银铜:在竞赛中获得第一二三名;②好习惯:自然月10天提交;③里程碑:解决1/2/5/10/20/50/100/200题;④每周打卡挑战:完成每周5题,每年1月1日清零。

收藏

收藏日期 题目名称 解决状态
没有收藏的题目。

评论笔记

评论日期 题目名称 评论内容 站长评论
没有评论过的题目。

提交记录

提交日期 题目名称 提交代码
2026-03-25 登录天数分布 
with t1 as(select usr_id, substring(login_time,1,10) as day
from user_login_log
where datediff(now(),login_time)<=180
 group by usr_id, substring(login_time,1,10))
, t2 as( select 
 	usr_id,count(*) as cnt
 from t1
 group by usr_id)
, t3 as( select 
 	usr_id,
cnt,
case when cnt>=1 and cnt <=5 then 1 else 0 end as days_1_to_5,
case when cnt>5 and cnt<11 then 1 else 0 end as days_6_to_10,
case when cnt>10 and cnt<21 then 1 else 0 end as days_11_to_20,
case when cnt>20 then 1 else 0 end as days_over_20,
1 as flag
 from t2)
 , t4 as(
 	select
 		flag ,
 		sum(days_1_to_5) as days_1_to_5,
 		sum(days_6_to_10) as days_6_to_10,
 		sum(days_11_to_20) as days_11_to_20,
 		sum(days_over_20) as days_over_20
 from t3 
 group by flag
 )
 select days_1_to_5,days_6_to_10,days_11_to_20,days_over_20 from t4