排名

用户解题统计

过去一年提交了

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

收藏

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

评论笔记

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

提交记录

提交日期 题目名称 提交代码
2025-02-25 通勤、午休、临睡个时间段活跃人数分布 
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' then usr_id
 when 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');
2025-02-25 用户"kjhd30"的第一笔未完成订单 
select *
from didi_order_rcd
where cust_uid = 'kjhd30' and finish_time = '1970-01-01 00:00:00'
order by call_time
limit 1;
2025-02-25 滴滴面试真题(2)打车订单呼叫应答时间 
select sum(timestampdiff(second,call_time,grab_time))/count(*) as avg_response_time_seconds
from didi_order_rcd
where grab_time != '1970-01-01 000:00:00'
2025-02-25 滴滴面试真题(2)打车订单呼叫应答时间 
select sum(timestampdiff(second,call_time,grab_time))/count(*) as avg_response_time_seconds
from didi_order_rcd
where finish_time != '1970-01-01 000:00:00'
2025-02-25 滴滴面试真题(2)打车订单呼叫应答时间 
select sum(timestampdiff(second,call_time,grab_time))/count(*) as avg_response_time_seconds
from didi_order_rcd
where cancel_time is not null;
2025-02-25 不分类别的最火直播间 
select t2.live_id,t2.live_nm,count(*) as enter_cnt
from ks_live_t1 t1
join ks_live_t2 t2
on t1.live_id = t2.live_id
where DATE_FORMAT(t1.enter_time,'%Y-%m-%d %H') = '2021-09-12 23'
group by t1.live_id,t2.live_nm
order by enter_cnt desc
limit 5;
2025-02-25 绘制小时进入人数曲线 
select lpad(hour_entered,2,'0') as hour_entered, enter_count
from(
 select hour(enter_time) as hour_entered,
count(*) as enter_count
from ks_live_t1
group by hour(enter_time)) as new_table
order by hour_entered asc;
2025-02-25 绘制小时进入人数曲线 
select lpad(hour_entered,2,'0') as hour_entered, enter_count
from(
 select hour(enter_time) as hour_entered,
count(*) as enter_count
from ks_live_t1 t1 join ks_live_t2 t2 on t1.live_id = t2.live_id
group by hour(enter_time)) as new_table
order by hour_entered asc;
2025-02-25 德州扑克起手牌- 手对 
select *
from hand_permutations
where left(card1,1) = left(card2,1)
order by id asc;
2025-02-25 德州扑克起手牌- A花 
select *
from hand_permutations
where right(card1,1) = right(card2,1) and (card1 like 'A%' or card2 like 'A%')
order by id asc;
2025-02-25 德州扑克起手牌-最强起手牌KK+ 
select *
from hand_permutations
where concat(card1,card2) like '%A%A%' or
concat(card1,card2) like '%A%K%' or
concat(card1,card2) like '%K%K%' or 
concat(card1,card2) like '%K%A%'
order by id
2025-02-25 德州扑克起手牌-最强起手牌KK+ 
select *
from hand_permutations
where concat(card1,card2) like '%A%A' or
concat(card1,card2) like '%A%K' or
concat(card1,card2) like '%K%K' or 
concat(card1,card2) like '%K%A'
order by id
2025-02-25 销售金额前10的商品信息 
select goods_id,sum(order_gmv) as total_gmv
from order_info
where date(order_time)='2024-09-10'
group by goods_id
order by total_gmv desc
limit 10;
2025-02-25 表连接(2)渣男去过我对象没去过,那就用LeftJoin 
select a.mch_nm as asshole_tried,a.trx_cnt,b.mch_nm as darling_tried from
(select mch_nm,count(mch_nm) trx_cnt
from cmb_usr_trx_rcd
where year(trx_time) in (2023,2024) and usr_id = '5201314520'
group by mch_nm
having count(1)>=20)a
left join 
(select distinct mch_nm
from cmb_usr_trx_rcd
where year(trx_time) in (2023,2024) and usr_id = '5211314521')b
on a.mch_nm = b.mch_nm order by trx_cnt desc
2025-02-25 子查询(1)玩的最嗨那天在做甚?要用Where子查询 
select *
from cmb_usr_trx_rcd
where trx_amt = (
select max(trx_amt)
from cmb_usr_trx_rcd
where usr_id = '5201314520' and year(trx_time) = 2024 )
and usr_id = '5201314520' and year(trx_time)= 2024;
2025-02-16 字符串与通配符(1)名称里面有特服,可以使用通配符 
select count(distinct mch_nm) as mch_cnt
from cmb_usr_trx_rcd
where mch_nm like '%按摩保健休闲%'
2025-02-16 分类(1)姿势太多很过分,分类要用CaseWhen 
select 
case 
 when trx_amt=288 then '1.WithHand'
 when trx_amt=388 then '2.WithMimi'
 when trx_amt=588 then '3.BlowJobbie'
 when trx_amt=888 then '4.Doi'
 when trx_amt=1288 then '5.DoubleFly'
 else '6.other'
end as ser_typ,
 count(trx_amt) as trx_cnt,
 min(date(trx_time)) as first_date 
from 
 cmb_usr_trx_rcd 
where 
 usr_id = '5201314520' and mch_nm = '红玫瑰按摩保健休闲'
group by ser_typ
order by ser_typ
2025-02-16 分类(1)姿势太多很过分,分类要用CaseWhen 
select
case when trx_amt=288 then '1.WithHand'
when trx_amt=388 then '2.WithMimi'
when trx_amt=588 then '3.BlowJobbie'
when trx_amt=888 then '4.Doi'
when trx_amt=1288 then '5.DoubleFly'
else '6.other'
end as ser_typ
,count(trx_amt) as trx_cnt
,min(date(trx_time)) as first_date
from 
cmb_usr_trx_rcd
where usr_id='5201314520' and mch_nm='红玫瑰按摩保健休闲'
group by ser_typ
order by ser_typ
2025-02-16 分类(1)姿势太多很过分,分类要用CaseWhen 
select
case when trx_amt=288 then '1.WithHand'
when trx_amt=388 then '2.WithMimi'
when trx_amt=588 then '3.BlowJobbie'
when trx_amt=888 then '4.Doi'
when trx_amt=1288 then '5.DoubleFly'
else '6.other'
end as ser_typ
,count(trx_amt) as trx_cnt
,min(date(trx_time)) as first_date
from 
cmb_usr_trx_rcd
where usr_id='5201314520' and mch_nm='红玫瑰按摩保健休闲'
group by ser_typ
2025-02-16 分组与聚合函数(6)想知道渣男有多坏,疯狂使用GroupBy 
select usr_id,mch_nm,sum(trx_amt) as trx_amt, count(trx_amt) as trx_cnt,min(trx_time) as first_time
from cmb_usr_trx_rcd
where usr_id = '5201314520' and trx_amt >=288
group by usr_id,mch_nm
order by trx_cnt desc;