全站第 35/1267 名
解决了 48/335 题
中等: 1/76
入门: 25/77
困难: 0/29
简单: 13/114
草履虫: 9/39
过去1年一共提交 87 次
Sep
Oct
Nov
Dec
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
勋章 ①金银铜:在竞赛中获得第一二三名;②好习惯:自然月10天提交;③里程碑:解决1/2/5/10/20/50/100/200题;④每周打卡挑战:完成每周5题,每年1月1日清零。
达成1题里程碑2025-05-10
达成2题里程碑2025-05-10
达成5题里程碑2025-05-11
达成10题里程碑2025-05-11
达成20题里程碑2025-05-12
完成w12打卡2025-05-14
完成w13打卡2025-05-11
完成w14打卡2025-05-12
完成w16打卡2025-05-14
完成w17打卡2025-05-14
完成w18打卡2025-05-14
完成w24打卡2025-05-14
完成w25打卡2025-05-14
完成w28打卡2025-05-14
完成w29打卡2025-05-14
完成w30打卡2025-05-13
完成w31打卡2025-05-12
完成w33打卡2025-05-12
完成第1天:条件过滤2025-08-19
完成第2天:分组和聚合函数2025-08-19
完成第3天:时间日期函数2025-08-19
完成第4天:字符串处理2025-08-19收藏
| 收藏日期 | 题目名称 | 解决状态 |
|---|---|---|
| 2025-05-17 | 字符串与通配符(2)好多关键词做规则,可以使用rlike | 已解决 |
| 2025-05-14 | 通勤、午休、临睡个时间段活跃人数分布 | 已解决 |
| 2025-05-14 | 上月活跃用户数 | 已解决 |
| 2025-05-13 | 冬季下雪天数 | 已解决 |
| 2025-05-13 | 滴滴面试真题(2)打车订单呼叫应答时间 | 已解决 |
评论笔记
提交记录
| 提交日期 | 题目名称 | 提交代码 |
|---|---|---|
| 2025-05-22 | 不分类别的最火直播间 |
select k1.live_id,live_nm,count(*) enter_cnt from ks_live_t1 k1 join ks_live_t2 k2 on k1.live_id=k2.live_id where enter_time between '2021-09-12 23:00:00' and '2021-09-12 23:59:59' group by k1.live_id,live_nm order by enter_cnt desc limit 5 |
| 2025-05-17 | 字符串与通配符(2)好多关键词做规则,可以使用rlike |
select case when mch_nm like '%按摩保健休闲%' then '按摩保健休闲' when lower(mch_nm) regexp '按摩|保健|休闲|spa|养生|会所' then '按摩、保健、休闲、养生、SPA、会所' end as reg_rules, count(distinct mch_nm) as mch_cnt from cmb_usr_trx_rcd where mch_nm like '%按摩保健休闲%' or lower(mch_nm) regexp '按摩|保健|休闲|spa|养生|会所' group by reg_rules order by mch_cnt desc; |
| 2025-05-14 | 按歌手名字字符长度统计歌手个数 |
select length(singer_name),count(singer_name) from singer_info group by length(singer_name) |
| 2025-05-14 | 统计字符长度 |
select singer_name,char_length(singer_name) len from singer_info |
| 2025-05-14 | 歌手名字大写 |
select upper(singer_name) from singer_info |
| 2025-05-14 | 北京有雪的日子 |
select dt,tmp_h,tmp_l,con from weather_rcd_china where con like '%雪%' and city ='beijing' |
| 2025-05-14 | 北京有雪的日子 |
select dt,tmp_h,tmp_l,con,wnd from weather_rcd_china where con like '%雪%' and city ='beijing' |
| 2025-05-14 | 北京有雪的日子 |
select dt,tmp_h,tmp_l,con,wnd from weather_rcd_china where con like '雪' and city ='beijing' |
| 2025-05-14 | 人数最多的学生姓氏 |
select left(name,1) as surname,count(*) as cnt from students group by surname order by cnt desc limit 5 |
| 2025-05-14 | 多云天气天数 |
select city,count(dt) as cloudy_days,concat(round(count(dt)/365*100,2),'%') as p from weather_rcd_china where year(dt)=2021 and con like '%多云%' group by city order by p desc |
| 2025-05-14 | 德州扑克起手牌- 手对 |
select * from hand_permutations where left(card1,1)=left(card2,1) |
| 2025-05-14 | 德州扑克起手牌- A花 |
select * from hand_permutations where right(card1,1)=right(card2,1) and (card1 like 'A%' or card2 like 'A%') order by id |
| 2025-05-14 | 德州扑克起手牌-最强起手牌KK+ |
select * from hand_permutations where concat(card1,card2) like'%A%K%' or concat(card1,card2) like'%A%A%' or concat(card1,card2) like'%K%A%' or concat(card1,card2) like'%K%K%' order by id |
| 2025-05-14 | 字符串与通配符(2)好多关键词做规则,可以使用rlike |
select case when mch_nm like '%按摩保健休闲%' then '按摩保健休闲' when lower(mch_nm) rlike '.*(按摩|保健|休闲|spa|养生|会所).*' then '按摩、保健、休闲、养生、SPA、会所' end as reg_rules, count(distinct mch_nm) as mch_cnt from cmb_usr_trx_rcd where mch_nm like '%按摩保健休闲%' or lower(mch_nm) rlike '.*(按摩|保健|休闲|spa|养生|会所).*' group by reg_rules order by mch_cnt desc; |
| 2025-05-14 | 字符串与通配符(2)好多关键词做规则,可以使用rlike |
select case when mch_nm like '%按摩保健休闲%' then '按摩保健休闲' when lower(mch_nm) rlike '.*(按摩|保健|休闲|spa|养生|会所).*' then '按摩、保健、休闲、养生、SPA、会所' end as reg_rules, count(distinct mch_nm) as mch_cnt from cmb_usr_trx_rcd where lower(mch_nm) rlike '.*(按摩|保健|休闲|spa|养生|会所).*' group by reg_rules order by mch_cnt desc; |
| 2025-05-14 | 字符串与通配符(2)好多关键词做规则,可以使用rlike |
select '按摩、保健、休闲、养生、SPA、会所' as reg_rules,count(distinct mch_nm) from cmb_usr_trx_rcd where mch_nm like '%按摩%' or mch_nm like '%保健%' or mch_nm like '%休闲%' or mch_nm like '%养生%' or mch_nm like '%SPA%' or mch_nm like '%会所%' union select '按摩保健休闲'as reg_rules,count(distinct mch_nm) from cmb_usr_trx_rcd where mch_nm like '%按摩保健休闲%' |
| 2025-05-14 | 字符串与通配符(1)名称里面有特服,可以使用通配符 |
select count(distinct mch_nm) as mch_cnt from cmb_usr_trx_rcd where mch_nm like '%按摩保健休闲%' |
| 2025-05-14 | 用户听歌习惯的时间分布 |
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 |
| 2025-05-14 | 用户听歌习惯的时间分布 |
select user_id, case when dayofweek(start_time) =1 then 'Sunday' when dayofweek(start_time) =2 then 'Monday' when dayofweek(start_time) =3 then 'Tuesday' when dayofweek(start_time) =4 then 'Wednesday' when dayofweek(start_time) =5 then 'Thursday' when dayofweek(start_time) =6 then 'Friday' when dayofweek(start_time) =7 then 'Saturday' end 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 |
| 2025-05-14 | 渣男腰子可真行,端午中秋干不停 |
select * from cmb_usr_trx_rcd where usr_id =5201314520 and (date(trx_time) between '2024-06-08' and '2024-06-10' or date(trx_time) between '2024-09-15' and '2024-09-17') order by trx_time asc |
“按摩保健休闲”在你的第一段sql里,被算了一遍了。 where mch_nm like '%按摩%'这个筛选条件已经把“按摩保健休闲”计算一遍了。这道题就是为了告诉你,字符串也是可以比较的,比较的逻辑就是字符编码的位置。你把下面这段代码丢给大模型问问是什么意思就明白啦 select ord('J'),ord('K'),ord('Q')