排名

用户解题统计

过去一年提交了

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

错题集 数据思维刷题中答错的题目

模块 知识点 题目 你的答案 正确答案 操作
暂无错题,继续保持!

收藏

收藏日期 题目名称 解决状态
2026-03-19 横屏与竖屏视频的完播率(按AI配音和字幕分类)  已解决
2026-02-07 播放量最高的标签  已解决
2026-02-04 会员与非会员的日均观看视频数量  已解决
2026-02-04 抖音面试真题(4)T+1月留存  已解决
2026-01-08 一线城市历年平均气温  已解决
2026-01-08 上月活跃用户数  已解决

评论笔记

评论日期 题目名称 评论内容 站长评论
2026-01-30 小丑竟是我自己 
题目写的是小丑指数在88和99之间,但是正确答案是小丑指数在80和99之间,题目写错了
啥也没说
2026-01-29 窗口函数(1)年度前三和每月前三,搞懂排序窗口函数 
-- rollup方法(mysql8.0+)
with t1 as (
select date_format(trx_time,'%Y-%m') as trx_mon,mch_nm,sum(trx_amt) as sum_trx_amt
from cmb_usr_trx_rcd
where trx_time>='2024-01-01' and trx_time<'2025-01-01' and usr_id=5201314520
group by mch_nm,trx_mon 
with rollup 
having trx_mon is not null or mch_nm is not null
),
t2 as (
select coalesce(trx_mon,2024) as trx_mon,mch_nm,sum_trx_amt,row_number() over(partition by coalesce(trx_mon,2024) order by sum_trx_amt desc) as rk 
from t1
)
select trx_mon,mch_nm,sum_trx_amt 
from t2 
where rk<=3 
order by trx_mon asc,sum_trx_amt desc
啥也没说
2026-01-29 深圳气温异常年份 
mysql> select round(cast(23.12500000 as float),2) as 单精度浮点数;
+--------------------+
| 单精度浮点数       |
+--------------------+
|              23.12 |
+--------------------+
1 row in set (0.00 sec)

mysql> select round(cast(23.12500000 as double),2) as 双精度浮点数;
+--------------------+
| 双精度浮点数       |
+--------------------+
|              23.12 |
+--------------------+
1 row in set (0.00 sec)
mysql> select round(23.12500000,2) as mysql正常小数;
+-------------------+
| mysql正常小数     |
+-------------------+
|             23.13 |
+-------------------+
1 row in set (0.00 sec)
啥也没说

提交记录

提交日期 题目名称 提交代码
2026-08-17 用户听歌习惯的时间分布 
select user_id,dayname(start_time) as day_of_week,count(*) as listens_per_day
from listen_rcd
group by user_id,day_of_week
order by user_id,day_of_week
2026-08-17 渣男腰子可真行,端午中秋干不停 
select *
from cmb_usr_trx_rcd 
where (trx_time>='2024-06-08' and trx_time<'2024-06-11' or trx_time>='2024-09-15' and trx_time<'2024-09-18')and usr_id=5201314520
order by trx_time
2026-08-17 渣男腰子可真行,端午中秋干不停 
select *
from cmb_usr_trx_rcd 
where trx_time>='2024-06-08' and trx_time<'2024-06-11' or trx_time>='2024-09-15' and trx_time<'2024-09-18'and usr_id=5201314520
order by trx_time
2026-08-17 渣男腰子可真行,端午中秋干不停 
select *
from cmb_usr_trx_rcd 
where trx_time>='2024-06-08' and trx_time<'2024-06-11' or trx_time>='2024-09-15' and trx_time<'2024-09-18'and usr_id='5201314520'
order by trx_time
2026-08-17 通勤、午休、临睡个时间段活跃人数分布 
select count(distinct case when time(login_time) between '07:30:00' and '09:30:00' or time(login_time) between '18:30:00' and '20:30:00' then usr_id end) as commute,
count(distinct case when time(login_time) between '11:30:00' and '14:00:00' then usr_id end) as lunch_break, 
count(distinct case when time(login_time) between '22:30:00' and '23:59:59' or time(login_time) between '00:00:00' and '01:00:00' then usr_id end) as bedtime
from user_login_log
where login_time>=date_format(date_sub(curdate(),interval 1 month),'%Y-%m-01') and login_time<date_format(curdate(),'%Y-%m-01')
2026-08-17 上月活跃用户数 
select count(distinct usr_id) as active_users
from user_login_log
where year(login_time)=year(curdate()) and month(login_time)=month(curdate())-1
2026-08-17 上月活跃用户数 
select count(distinct usr_id) as active_users
from user_login_log
where login_time>=date_format(date_sub(curdate(),interval 1 month),'%Y-%m-01') and login_time<date_format(curdate(),'%Y-%m-01')
2026-08-17 一线城市历年平均气温 
select year(dt) as Y,
cast(avg(case when city='beijing' then tmp_h end) as decimal(4,2)) as 北京,
cast(avg(case when city='shanghai' then tmp_h end) as decimal(4,2)) as 上海,
cast(avg(case when city='shenzhen' then tmp_h end) as decimal(4,2)) as 深圳,
cast(avg(case when city='guangzhou' then tmp_h end) as decimal(4,2)) as 广州
from weather_rcd_china
where year(dt) between 2011 and 2022
group by year(dt)
2026-08-17 一线城市历年平均气温 
select year(dt) as Y,
round(avg(case when city='beijing' then tmp_h end),2) as 北京,
round(avg(case when city='shanghai' then tmp_h end),2) as 上海,
round(avg(case when city='shenzhen' then tmp_h end),2) as 深圳,
round(avg(case when city='guangzhou' then tmp_h end),2) as 广州
from weather_rcd_china
where year(dt) between 2011 and 2022
group by year(dt)
2026-08-17 冬季下雪天数 
select city,count(case when con like '%雪%' then 1 end) as snowy_days
from weather_rcd_china 
where month(dt) in (12,1,2)
group by city
order by snowy_days desc
2026-08-17 滴滴面试真题(2)打车订单呼叫应答时间 
select round(avg(timestampdiff(second,call_time,grab_time)),4) as avg_response_time_seconds
from didi_order_rcd 
where grab_time<>'1970-01-01 00:00:00'
2026-08-17 分组与聚合函数(5)想知道何时成瘾,用Max Or Min? 
select usr_id,min(trx_time) as first_time,mch_nm
from cmb_usr_trx_rcd 
where usr_id=5201314520 and mch_nm='红玫瑰按摩保健休闲'
2026-08-17 分组与聚合函数(5)五花八门的项目,其实都有固定套路(2) 
select trx_amt,count(*) as total_trx_cnt,count(distinct usr_id) as unique_usr_cnt,
round(count(*)/count(distinct usr_id),4) as avg_trx_per_user
from cmb_usr_trx_rcd
where mch_nm='红玫瑰按摩保健休闲' and trx_time>='2023-01-01' and trx_time<'2024-07-01'
group by trx_amt
order by avg_trx_per_user desc
limit 5
2026-08-17 分组与聚合函数(3)五花八门的项目,其实都有固定套路(1) 
select trx_amt,count(*) as trx_cnt
from cmb_usr_trx_rcd
where mch_nm='红玫瑰按摩保健休闲' and year(trx_time)=2024 and month(trx_time) between 1 and 7
group by trx_amt
order by trx_cnt desc
limit 5
2026-08-17 分组与聚合函数(2)擦边营收怎么样,聚合函数可看出 
select date(trx_time) as trx_date,max(trx_amt) as max_trx_amt,min(trx_amt) as min_trx_amt,
avg(trx_amt) as avg_trx_amt,sum(trx_amt) as sum_trx_amt
from cmb_usr_trx_rcd 
where trx_time>='2024-09-01' and trx_time<'2024-10-01' and mch_nm='红玫瑰按摩保健休闲'
group by date(trx_time)
order by trx_date
2026-08-17 分组与聚合函数(1)Money全都花在哪,GroupBy来查一查 
select mch_nm,sum(trx_amt) as sum_trx_amt
from cmb_usr_trx_rcd 
where usr_id=5201314520 and year(trx_time)=2024 
group by mch_nm
order by sum_trx_amt desc
2026-08-17 条件过滤(3)Hour函数很给力,组合条件要仔细 
select *
from cmb_usr_trx_rcd
where usr_id=5201314520 and trx_time>='2024-09-01' and trx_time<'2024-10-01' and hour(trx_time) in (22,23,0,1,2,3,4,5)
order by trx_time
2026-08-17 条件过滤(2)半夜活动有猫腻,Hour函数给给力 
select * 
from cmb_usr_trx_rcd 
where usr_id=5201314520 and trx_time>='2024-09-01' and trx_time<'2024-10-01' and hour(trx_time) between 1 and 5
order by trx_time
2026-08-17 条件过滤(1)异地男友有异常,数分闺蜜来帮忙 
select * 
from cmb_usr_trx_rcd
where usr_id=5201314520 and trx_time>='2024-09-01' and trx_time<'2024-10-01'
order by trx_time
2026-08-16 基于共同兴趣爱好的餐厅推荐(1)-我吃过啥 
select distinct cust_uid,mch_nm
from mt_trx_rcd1 
where cust_uid='MT10000'
order by mch_nm