排名

用户解题统计

过去一年提交了

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

收藏

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

评论笔记

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

提交记录

提交日期 题目名称 提交代码
2026-03-04 只被购买未被收藏的商品 
select distinct
gd_id,
gd_nm,
gd_typ
from gd_inf gd
join xhs_pchs_rcd pchs
on gd.gd_id=pchs.mch_id
left join xhs_fav_rcd fav
on pchs.mch_id=fav.mch_id
where fav.mch_id is null;
2026-03-04 只被收藏未被购买的商品 
select distinct
gd.gd_id,
gd.gd_nm,
gd.gd_typ
from
gd_inf gd
join
xhs_fav_rcd fav
on gd.gd_id=fav.mch_id
left join
xhs_pchs_rcd pchs
on fav.mch_id=pchs.mch_id
where pchs.mch_id is null;
2026-03-04 购买人数最多的商品类目 
select
gd.gd_typ,
count(distinct pchs.cust_uid) as pchs_count
from xhs_pchs_rcd pchs
join
gd_inf gd
on pchs.mch_id=gd.gd_id
group by
gd.gd_typ
order by
pchs_count desc
limit 1;
2026-03-04 购买人数最多的商品类目 
select
gd.gd_typ,
count(pchs.mch_id) as pchs_count
from xhs_pchs_rcd pchs
join
gd_inf gd
on pchs.mch_id=gd.gd_id
group by
gd.gd_typ
order by
pchs_count desc
limit 1;
2026-03-04 被收藏次数最多的商品 
select
gd.gd_id,
gd.gd_nm,
count(fav.fav_trq) as fav_count
from xhs_fav_rcd fav 
left join
gd_inf gd
on
fav.mch_id=gd.gd_id
group by
gd.gd_id,
gd.gd_nm
order by
fav_count desc
limit 1;
2026-02-01 购买人数最多的商品类目 
select
gd.gd_typ,
count(distinct(pchs.cust_uid)) as pchs_count
from
xhs_pchs_rcd pchs
join
gd_inf gd on pchs.mch_id=gd.gd_id
group by
gd.gd_typ
order by
pchs_count desc
limit 1;
2026-02-01 购买人数最多的商品类目 
select
gd.gd_typ,
count(distinct(pchs.pch_trq)) as pchs_count
from
xhs_pchs_rcd pchs
join
gd_inf gd on pchs.mch_id=gd.gd_id
group by
gd.gd_typ
order by
pchs_count desc
limit 1;
2026-02-01 购买人数最多的商品类目 
select
gd.gd_id,
gd.gd_nm,
count(distinct(pchs.pch_trq)) as pchs_count
from
xhs_pchs_rcd pchs
join
gd_inf gd on pchs.mch_id=gd.gd_id
group by
gd.gd_id,
gd.gd_nm
order by
pchs_count desc
limit 1;
2026-02-01 被收藏次数最多的商品 
select
gd.gd_id,
gd.gd_nm,
count(fav.fav_trq) as fav_count
from
xhs_fav_rcd fav
join
gd_inf gd on gd.gd_id=fav.mch_id
group by
gd.gd_id,
gd.gd_nm
order by
fav_count desc
limit 1;
2026-02-01 被收藏次数最多的商品 
select
gd.gd_id,
gd.gd_nm,
count(fav.fav_trq) as fav_count
from
xhs_fav_rcd fav
join
gd_inf gd on gd.gd_id=fav.mch_id
group by
gd.gd_id,
gd.gd_nm
order by
fav_count desc
limit 5;
2026-01-27 购买人数最多的商品类目 
select
gd.gd_typ,
count(distinct(cust_uid)) as pch_count
from
xhs_pchs_rcd pch
join
gd_inf gd on gd.gd_id=pch.mch_id
group by
gd.gd_typ
order by
pch_count desc
limit 1;
2026-01-27 被收藏次数最多的商品 
select
gd.gd_id,
gd.gd_nm,
count(fav.fav_trq) as fav_count
from
xhs_fav_rcd fav
join
gd_inf gd on fav.mch_id=gd.gd_id
group by
gd.gd_id,
gd.gd_nm
order by
fav_count desc
limit 1;
2026-01-24 被收藏次数最多的商品 
select
gd.gd_id,
gd.gd_nm,
count(fav.fav_trq) as fav_count
from
xhs_fav_rcd fav
join
gd_inf gd on fav.mch_id=gd.gd_id
group by
gd.gd_id,gd.gd_nm
order by
fav_count desc
limit 1;
2026-01-23 购买人数最多的商品类目 
select
gd.gd_typ,
count(pchs.pch_trq) as pchs_count
from
xhs_pchs_rcd pchs
join
gd_inf gd on pchs.mch_id=gd.gd_id
group by
gd.gd_typ
order by
gd.gd_typ desc
limit 1;
2026-01-23 购买人数最多的商品类目 
select
gd.gd_typ,
count(pchs.pch_trq) as pchs_count
from
xhs_pchs_rcd pchs
join
gd_inf gd on pchs.mch_id=gd.gd_id
group by
gd.gd_typ
order by
gd.gd_typ
limit 1;
2025-11-13 数学成绩分段统计(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 '(60,0]'
 end as score_range,
count(*) as num_students
from students st
join scores sc
on st.student_id=sc.student_id
where sc.exam_date='2024-06-30' and sc.subject='数学'
group by score_range
ORDER BY 
    score_range DESC;
2025-11-13 数学成绩分段统计(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 '(60,0]'
 end as score_range,
count(*) as num_students
from students st
join scores sc
on st.student_id=sc.student_id
where sc.exam_date='2024-06-30' and sc.subject='数学'
group by score_range;
2025-11-13 数学成绩分段统计(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 '(60,0]'
 end as score_range,
count(*) as num_students
from students st
join scores sc
on st.student_id=sc.student_id
where sc.exam_date='2024-06-30' and sc.subject='数学'
group by score_range
order by num_students;
2025-11-13 数学成绩分段统计(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 '(60,0]'
 end as score_range,
count(*) as num_students
from students st
join scores sc
on st.student_id=sc.student_id
where exam_date='2024-06-30' and sc.subject='数学'
group by score_range
order by num_students;
2025-11-12 数学成绩分段统计(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(st.student_id) as num_students 
from students st
join scores sc
on st.student_id=sc.student_id
where sc.subject='数学' and sc.exam_date='2024-06-30'
group by score_range;