排名

用户解题统计

过去一年提交了

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

收藏

收藏日期 题目名称 解决状态
2025-03-12 抖音面试真题(1)T+1日留存率  未解决

评论笔记

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

提交记录

提交日期 题目名称 提交代码
2025-03-04 分组与聚合函数(5)五花八门的项目,其实都有固定套路(2) 
select trx_amt
,count(*) as total_trx_cnt
,count(distinct usr_id) as unique_usr_cnt
,count(*) / count(distinct usr_id) as avg_trx_per_user
from cmb_usr_trx_rcd
where mch_nm = '红玫瑰按摩保健休闲'
and (year(trx_time) = 2023
 or
(year(trx_time) = 2024 
 and
 month(trx_time) between 1 and 6)
 )
group by
    trx_amt
order by
    avg_trx_per_user desc
limit 5
2025-03-04 分组与聚合函数(5)五花八门的项目,其实都有固定套路(2) 
select trx_amt
,count(*) as total_trx_cnt
,count(distinct usr_id) as unique_usr_cnt
,count(*) / count(distinct usr_id) as avg_trx_per_user
from cmb_usr_trx_rcd
where mch_nm = '红玫瑰按摩保健休闲'
and (year(trx_time) = 2023
 or
(year(trx_time) = 2024 
 and
 month(trx_time) between 1 and 6)
 )
group by
    trx_amt
order by
    avg_trx_per_user desc
2025-03-04 分组与聚合函数(5)五花八门的项目,其实都有固定套路(2) 
select trx_amt
,count(1) as total_trx_cnt
,count(distinct usr_id) as unique_usr_cnt
,count(1) / count(distinct usr_id) as avg_trx_per_user
from cmb_usr_trx_rcd
where mch_nm = '红玫瑰按摩保健休闲'
and (year(trx_time) = 2023
 or
(year(trx_time) = 2024 
 and
 month(trx_time) between 1 and 6)
 )
group by
    trx_amt
order by
    avg_trx_per_user desc
limit 5
2025-03-04 分组与聚合函数(5)五花八门的项目,其实都有固定套路(2) 
select trx_amt
,count(1) as total_trx_cnt
,count(distinct usr_id) as unique_usr_cnt
,count(1) / count(distinct usr_id) as avg_trx_per_user
from cmb_usr_trx_rcd
where mch_nm = '红玫瑰按摩保健休闲'
and (year(trx_time) = 2023)
or(year(trx_time) = 2024 
 and
 month(trx_time) between 1 and 6)
group by
    trx_amt
order by
    avg_trx_per_user desc
limit 5
2025-03-04 分组与聚合函数(5)五花八门的项目,其实都有固定套路(2) 
select trx_amt
,count(1) as total_trx_cnt
,count(distinct usr_id) as unique_usr_cnt
,count(1) / count(distinct usr_id) as avg_trx_per_user
from cmb_usr_trx_rcd
where mch_nm = '红玫瑰按摩保健休闲'
and (year(trx_time) = 2023)
or(year(trx_time) = 2024 
 and
 month(trx_time) between 1 and 6)
group by
    trx_amt
order by
    avg_trx_per_user desc
2025-03-03 条件过滤(3)Hour函数很给力,组合条件要仔细 
select * 
from cmb_usr_trx_rcd 
where usr_id = 5201314520
and date(trx_time) between '2024-09-01' and '2024-09-30'
and (hour(trx_time) >=22
or hour(trx_time) between 0 and 5)
order by trx_time
2025-03-03 条件过滤(2)半夜活动有猫腻,Hour函数给给力 
select * 
from cmb_usr_trx_rcd 
where usr_id = 5201314520
and hour(trx_time) between 1 and 5
and date(trx_time) between '2024-09-01' and '2024-09-30'
order by trx_time
2025-03-02 查询所有终点是餐饮类地点的行程记录 
select 
	di.cust_uid,
di.start_loc,
di.end_loc,
di.start_tm,
di.car_cls
from
	didi_sht_rcd di
join
	loc_nm_ctg l
on di.end_loc =l.loc_nm
where l.loc_ctg ='餐饮'
order by di.start_tm
2025-03-02 语文数学英语至少1门超过100分的同学 
select student_id
,chinese
,math
,english
from subject_score
where chinese > 100
or math > 100
or english > 100
order by chinese
2025-03-02 语文数学英语至少1门超过100分的同学 
select student_id
,chinese
,math
,english
from subject_score
where chinese >= 100
or math >= 100
or english >= 100
order by chinese
2025-03-02 HAVING-执教教师超过3人的科目 
select subject
from teachers
group by subject
having count(name) >= 3
2025-03-02 HAVING-每次成绩都不低于80分的学生 
select student_id,
max(score) max_score,
min(score) min_score,
avg(score) avg_score
from scores
group by student_id
having min(score) >= 80
order by student_id
2025-03-02 CASE WHEN-男女学生的数量 
select 
	case gender
	when 'm' then '男'
when 'f' then '女'
end as gender_text, 
count(*) as student_count
from students
group by gender_text
2025-03-02 GROUP BY-各科目平均分 
select subject
,avg(score)
from scores
where exam_date = '2024-06-30'
group by subject
order by subject
2025-03-02 GROUP BY-各班级人数 
select class_code
,count(name) student_count
from students
group by class_code
order by student_count desc
2025-03-02 条件过滤-找出所有教授数学且具有高级职称的教师 
select name
,subject
,class_code
,qualification
from teachers
where qualification = 'Senior'
and subject = '数学'
order by name
2025-03-02 条件过滤-查找2009年出生的女学生 
select student_id
,name
,birth_date
from students
where year(birth_date) = 2009
and gender = 'f'
order by birth_date
2025-03-02 数学成绩分段统计(1) 
select
	case
	when sc.score >= 110 then '[110, 120]'
	when sc.score >= 90 then '[90, 110)'
	when sc.score >= 60 then '[60, 90)'
else '[0, 60)'
end as score_range,
count(*) as num_students
from scores sc
join students st
on sc.student_id=st.student_id
where sc.subject = '数学'
and sc.exam_date='2024-06-30'
group by score_range
2025-02-18 S1年级物理成绩前10名(2) 
WITH ranked_scores AS (
    SELECT 
        s.student_id, 
        s.name, 
        sc.score,
        RANK() OVER (ORDER BY sc.score DESC) AS ranking
    FROM 
        students s
    JOIN 
        scores sc ON s.student_id = sc.student_id
    WHERE 
        s.grade_code = 'S1' 
        AND sc.subject = '物理'
)
SELECT 
    student_id, 
    name, 
    score, 
    ranking
FROM 
    ranked_scores
WHERE 
    ranking <= 10
ORDER BY 
    ranking;
2025-02-18 S1年级物理成绩前10名(2) 
select s1.student_id
,s1.name
,s2.score
,rank()over(partition by subject order by score desc) rnk
from students s1
join scores s2
on s1.student_id=s2.student_id
where s1.grade_code = "S1"
and s2.subject = "物理"
limit 12