排名

用户解题统计

过去一年提交了

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

收藏

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

评论笔记

评论日期 题目名称 评论内容 站长评论
2025-01-17 表连接(1)你们难道都去过?那就试试用InnerJoin 
不用join on ,咱这正常来说也行呀——select  mch_nm from cmb_usr_trx_rcd where usr_id=5211314521 and  mch_nm in (select distinct mch_nm from cmb_usr_trx_rcd where usr_id=5211314520)  and year(trx_time)=2024;(还有就是我现在看到的题目了没有写升序降序,难道是网站的原因?)
输出示例里有排序要求。另外,in 和inner join的效率不一样的哦。
2025-01-16 分类(1)姿势太多很过分,分类要用CaseWhen 
虽然但是,一个大写的O制造的惨剧——
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(1) AS trx_cnt,
    MIN(date(trx_time)) AS first_date
FROM 
    cmb_usr_trx_rcd 
WHERE 
    mch_nm = '红玫瑰按摩保健休闲' and usr_id='5201314520'
    
    group by ser_typ
ORDER BY 
    ser_typ
啥也没说
2025-01-16 分组与聚合函数(1)Money全都花在哪,GroupBy来查一查 
拜托需求里没有些排序,答案里整个排序,然后本身对的答案不对....
排序提醒已加上;至于本身的答案不对,不是提醒你有坑了吗😁
2025-01-14 条件过滤(3)Hour函数很给力,组合条件要仔细 
SELECT * 
FROM cmb_usr_trx_rcd 
WHERE date(trx_time) BETWEEN '2024-09-01' AND '2024-09-30' 
  AND usr_id='5201314520' 
  AND (time(trx_time)>= '22:00:00'  or
  time(trx_time) between '00:00:00' AND '05:00:00')
ORDER BY trx_time;
答案一样,怎么提交失败
上一题告诉你了,“交易时间为凌晨1点至凌晨5点,即[01:00:00, 06:00:00)的所有交易记录。” 你改成6点就行了。
另外,本网站数据量非常大,答案只能展现有限的数据,仅供参考。不是答案一样就能通过的。答案一样只能说明前5条一样。
2025-01-14 条件过滤(1)异地男友有异常,数分闺蜜来帮忙 
在豆包里,有没有date它都说包含2024-09-30 12:23:23,给我都整蒙了,官方快出来解释详细的区别。
1、你试一下select '2024-09-30 12:23:23' between '2024-09-01' and '2024-09-30'
返回 0还是1,0就是False、1就是True。
2、多问几个大模型,带上数据库版本

提交记录

提交日期 题目名称 提交代码
2025-01-19 德州扑克起手牌-最强起手牌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-01-18 抖音面试真题(1)T+1日留存率 
with data1 as (
    select distinct 
        usr_id,
        date(login_time) as login_date 
    from 
        user_login_log 
    where 
        datediff(current_date, date(login_time)) <= 30
),
data2 as (
    select 
        T.usr_id, 
        T.login_date as T_date, 
        T_1.login_date as T_1_date 
    from 
        data1 as T 
    left join 
        data1 as T_1 
    on 
        T.usr_id = T_1.usr_id 
        and datediff(T.login_date, T_1.login_date) = -1
)
select 
    T_date as first_login_date, 
    concat(round(avg(T_1_date is not null)*100, 2), '%') as T1_retention_rate 
from 
    data2 
group by 
    T_date 
order by 
    T_date;
2025-01-18 销售金额前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 desclimit 10
2025-01-18 销售金额前10的商品信息 
select * from order_info where date(order_time)='2024-09-10' group by order_idorder by sum(order_gmv) desclimit 10
2025-01-18 销售金额前10的商品信息 
select * from order_info where date(order_time)='2024-09-10' group by order_idorder by count(order_gmv) desclimit 10
2025-01-18 表连接(2)渣男去过我对象没去过,那就用LeftJoin 
select a.mch_nm as asshole_tried,a.trx_cnt, b.mch_nm as darling_tried from 
(select mch_nm, count(1) 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
right 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 2 desc
2025-01-18 表连接(2)渣男去过我对象没去过,那就用LeftJoin 
select a.mch_nm as asshole_tried,a.trx_cnt, b.mch_nm as darling_tried from 
(select mch_nm, count(1) 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 2 desc
2025-01-18 表连接(2)渣男去过我对象没去过,那就用LeftJoin 
select a.mch_nm as asshole_tried,a.trx_cnt, b.mch_nm as darling_tried from 
(select mch_nm, count(1) 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 2 desc
2025-01-18 表连接(1)你们难道都去过?那就试试用InnerJoin 
select a.mch_nm from
(select distinct mch_nmfrom cmb_usr_trx_rcd where usr_id=5211314521 and year(trx_time)=2024)a
join
(select distinct mch_nmfrom cmb_usr_trx_rcd where usr_id=5201314520 and year(trx_time)=2024)b
on a.mch_nm=b.mch_nm order by mch_nm desc
2025-01-18 表连接(1)你们难道都去过?那就试试用InnerJoin 
select a.mch_nm from
(select distinct mch_nmfrom cmb_usr_trx_rcd where usr_id=5211314521 and year(trx_time)=2024)a
join
(select distinct mch_nmfrom cmb_usr_trx_rcd where usr_id=5201314520 and year(trx_time)=2024)b
on a.mch_nm=b.mch_nm
2025-01-18 表连接(1)你们难道都去过?那就试试用InnerJoin 
select a.mch_nm from
(select distinct mch_nmfrom cmb_usr_trx_rcd where usr_id=5211314521 and year(trx_time)=2024)a
join
(select distinct mch_nmfrom cmb_usr_trx_rcd where usr_id=5201314520 and year(trx_time)=2024)b
on a.mch_nm=b.mch_nm order by mch_nm
2025-01-18 表连接(1)你们难道都去过?那就试试用InnerJoin 
select a.mch_nm from
(select mch_nmfrom cmb_usr_trx_rcd where usr_id=5211314521 and year(trx_time)=2024)a
join
(select mch_nmfrom cmb_usr_trx_rcd where usr_id=5201314520 and year(trx_time)=2024)b
on a.mch_nm=b.mch_nm order by mch_nm
2025-01-18 表连接(1)你们难道都去过?那就试试用InnerJoin 
select a.mch_nm from
(select mch_nmfrom cmb_usr_trx_rcd where usr_id=5211314521 and year(trx_time)=2024)a
join
(select mch_nmfrom cmb_usr_trx_rcd where usr_id=5201314520 and year(trx_time)=2024)b
on a.mch_nm=b.mch_nm
2025-01-17 表连接(1)你们难道都去过?那就试试用InnerJoin 
select distinct mch_nm from cmb_usr_trx_rcdwhere mch_nm in (select distinct mch_nm from cmb_usr_trx_rcd where usr_id=5201314520 and year(trx_time)=2024 ) and usr_id=5211314521 and year(trx_time)=2024 order by mch_nm desc
2025-01-17 表连接(1)你们难道都去过?那就试试用InnerJoin 
select distinct mch_nm from cmb_usr_trx_rcdwhere mch_nm in (select distinct mch_nm from cmb_usr_trx_rcd where usr_id=5201314520 and year(trx_time)=2024 ) and usr_id=5211314521 and year(trx_time)=2024
2025-01-17 表连接(1)你们难道都去过?那就试试用InnerJoin 
select distinct a.mch_nm from cmb_usr_trx_rcd a where mch_nm in (select distinct mch_nm from cmb_usr_trx_rcd where usr_id=5201314520 and year(trx_time)=2024 ) and usr_id=5211314521 and year(trx_time)=2024 order by a.mch_nm
2025-01-17 表连接(1)你们难道都去过?那就试试用InnerJoin 
select distinct a.mch_nm from cmb_usr_trx_rcd a where mch_nm in (select distinct mch_nm from cmb_usr_trx_rcd where usr_id=5201314520 and year(trx_time)=2024 ) and usr_id=5211314521 and year(trx_time)=2024
2025-01-17 表连接(1)你们难道都去过?那就试试用InnerJoin 
select a.mch_nm from cmb_usr_trx_rcd a where mch_nm in (select distinct mch_nm from cmb_usr_trx_rcd where usr_id=5201314520 and year(trx_time)=2024 ) and usr_id=5211314521 and year(trx_time)=2024
2025-01-17 表连接(1)你们难道都去过?那就试试用InnerJoin 
select a.mch_nm from
(select distinct mch_nm from cmb_usr_trx_rcd where usr_id='5201314520' and year(trx_time)=2024) a
join
(select distinct mch_nm from cmb_usr_trx_rcd where usr_id='5211314521' and year(trx_time)=2024) b
on a.mch_nm=b.mch_nm order by mch_nm desc
2025-01-17 表连接(1)你们难道都去过?那就试试用InnerJoin 
select b.mch_nm from
(select distinct mch_nm from cmb_usr_trx_rcd where usr_id='5201314520' and year(trx_time)=2024) a
join
(select distinct mch_nm from cmb_usr_trx_rcd where usr_id='5211314521' and year(trx_time)=2024) b
on a.mch_nm=b.mch_nm order by mch_nm desc