排名

用户解题统计

过去一年提交了

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

收藏

收藏日期 题目名称 解决状态
2024-12-25 Halo出行-通勤活跃用户标签开发  未解决
2024-11-04 分类别的最火直播间  未解决
2024-10-29 条件过滤(3)Hour函数很给力,组合条件要仔细  已解决

评论笔记

评论日期 题目名称 评论内容 站长评论
2024-12-25 小宇宙电台的同期群分析 
答案在哪看?
我发你。
2024-11-21 窗口函数(5)越来越喜欢召妓,窗口函数用累计(3) 
题解的查询结果包含2024-Q4,题干要求是2023Q1-至今的
没毛病,😁,今天11月21号,也是Q4,这里不限制时间,所以是取最新啦。
2024-11-18 找出所有类别组合的最热门路线 
光星电子有限公司----流花山公园南门,光星电子有限公司----欢乐谷,都是企业到公园。同一类别trip_count都是8,并列第一,是不是应该用denserank。我用denserank报错来着
都是取第一,rank、dense_rank一样了。感谢抓虫
2024-11-07 时间日期(5)三腿爱往会所走,全当良心喂了狗 
要求计算在一起多少小时,为什么不是用'2022-10-03'和now(),current_date计算时间差,而是min()与now()和current_date?
有道理,已修正。重新提交就可以了
2024-11-05 表连接(5)哪些没被分出来,用左用内你来猜 
is null 3Q
如果有学到东西,请多多推荐哦!
开发题目不易,如果有纰漏的地方,也欢迎继续评论。感谢!😍
2024-11-04 表连接(5)哪些没被分出来,用左用内你来猜 
坑在哪???????
细品,啥叫没被分出来。where后面是不是还少了个过滤条件呢?

提交记录

提交日期 题目名称 提交代码
2025-08-22 优异物理成绩的分布 
SELECT 
    s.class_code, 
    COUNT(distinct s.student_id) AS num_students_90_plus, 
    ROUND(AVG(sc.score), 2) AS avg_score_90_plus, 
    t.name AS physics_teacher
FROM 
    students s
JOIN 
    scores sc ON s.student_id = sc.student_id
JOIN 
    teachers t ON t.class_code LIKE CONCAT('%', s.class_code, '%')
WHERE 
    sc.subject = '物理' 
    AND sc.score >= 90 and sc.exam_date='2024-06-30'
    AND t.subject = '物理'
GROUP BY 
    s.class_code, t.name
ORDER BY 
    avg_score_90_plus DESC;
2025-08-22 S1年级物理成绩前10名(2) 
with a as ( 
			select s.student_id,s.name,score,
				 rank()over(partition by grade_code order by score desc) as ranking
			from students as s 
inner join scores as sc
			on s.student_id=sc.student_id
			where sc.subject='物理'
			and grade_code='S1'
 			)
select student_id,name,score,ranking from a 
where ranking <=10
order by ranking
2025-08-22 S1年级物理成绩前10名(1) 
with a as (
			select s.student_id,s.name,sc.score,
				 row_number()over(partition by s.grade_code order by sc.score desc)as rnk
from students as s 
inner join scores as sc 
			on s.student_id=sc.student_id 
where s.grade_code= 'S1' and sc.subject='物理')
select student_id ,name ,score,rnk
from a 
where rnk <=10
order by rnk,student_id
2025-08-22 S1年级物理成绩前10名(1) 
select a.student_id,a.name,b.score,row_number()over(order by score desc) as rnk
from 
(select student_id ,name from students
where grade_code='S1') a
inner join
(select student_id,subject,score from scores 
where subject='物理') b
on a.student_id=b.student_id
limit 10
2025-08-22 S1年级物理成绩前10名(1) 
select a.student_id,a.name,b.score,row_number()over(order by score desc) as rnk
from 
(select student_id ,name from students
where grade_code='S1') a
inner join
(select student_id,subject,score from scores 
where subject='物理') b
on a.student_id=b.student_id
2025-08-22 S1年级物理成绩前10名(1) 
select a.student_id,a.name,b.score
from 
(select student_id ,name from students
where grade_code='S1') a
inner join
(select student_id,subject,score from scores 
where subject='物理') b
on a.student_id=b.student_id
order by score desc
2025-08-22 人数最多的学生姓氏 
select left(name,1) as surname,count(1) from students
 group by 1
 order by 2 desc
 limit 5
2025-08-22 学生信息和班主任姓名 
select s.name,s.class_code,s.grade_code,t.name as head_teacher_name
from students as s 
inner join teachers as t 
on s.class_code = t.head_teacher
order by student_id
2025-08-22 学生信息和班主任姓名 
select distinct a.name,a.class_code,a.grade_code,t.name
from 
( selectdistinct s.student_id,name,class_code,grade_code,subject
 from students as s 
 inner join scores as sc
 on s.student_id =sc.student_id) as a 
 inner join 
 teachers as t 
 on a.class_code = t.head_teacher
2025-08-22 学生信息和班主任姓名 
select distinct a.name,a.class_code,a.grade_code,t.head_teacher
from 
( selectdistinct s.student_id,name,class_code,grade_code,subject
 from students as s 
 inner join scores as sc
 on s.student_id =sc.student_id) as a 
 inner join 
 teachers as t 
 on a.class_code = t.head_teacher
2025-08-22 只买iPhone的用户 
select user_id from apple_pchs_rcd
group by 1
having sum(case when product_type <> 'iPhone' then 1 else 0 end) =0
order by 1
2025-08-22 基于共同兴趣爱好的餐厅推荐(6)-好基友(5) 
select cust_uid,cust_uid_1
from (
select distinct b.cust_uid,
				b.mch_nm as b_mch_nm,
				a.cust_uid_1,
				a.mch_nmas a_mch_nm
from 
(select cust_uid as cust_uid_1,mch_nm from mt_trx_rcd1
where cust_uid <>'MT10000') as a
right join
(select distinct cust_uid,mch_nm from mt_trx_rcd1
 where cust_uid = 'MT10000') as b
 on a.mch_nm =b.mch_nm
 order by 3) as c 
 group by 1,2
 having count(1)=14
2025-08-22 基于共同兴趣爱好的餐厅推荐(5)-好基友(4) 
select distinct c.cust_uid,b.cust_uid_1
from 
(selectcust_uid from mt_trx_rcd1 where cust_uid ='MT10000' ) as c
join(
select cust_uid_1 from (
select cust_uid as cust_uid_1,mch_nm from mt_trx_rcd1
 where mch_nm in ('品众素心素食餐厅','一枚帅哥做的菜','庄家界(千灯店)','黄记烘培宫廷桃酥王')
 and cust_uid <> 'MT10000'
 group by 1,2
 order by 1,2) as a 
group by 1
having count(1)=4
order by 1) b
2025-08-22 基于共同兴趣爱好的餐厅推荐(5)-好基友(3) 
select distinct c.cust_uid,b.cust_uid_1 from 
(select cust_uid from mt_trx_rcd1where cust_uid ='MT10000') c
join (
select cust_uid_1 from (
select distinct cust_uid as cust_uid_1,mch_nm from mt_trx_rcd1
where (mch_nm ='庄家界(千灯店)' or mch_nm='黄记烘培宫廷桃酥王' or mch_nm='品众素心素食餐厅')
and cust_uid <> 'MT10000'
order by cust_uid ) a 
group by 1
having count(1)=3
order by 1
) b
2025-08-22 基于共同兴趣爱好的餐厅推荐(5)-好基友(3) 
select c.cust_uid,b.cust_uid_1 from 
(select cust_uid from mt_trx_rcd1where cust_uid ='MT10000') c
join (
select cust_uid_1 from (
select distinct cust_uid as cust_uid_1,mch_nm from mt_trx_rcd1
where (mch_nm ='庄家界(千灯店)' or mch_nm='黄记烘培宫廷桃酥王' or mch_nm='品众素心素食餐厅')
and cust_uid <> 'MT10000'
order by cust_uid ) a 
group by 1
having count(1)=3
order by 1
) b
2025-08-21 基于共同兴趣爱好的餐厅推荐(4)-好基友(2) 
select distinct b.cust_uid,c.cust_uid_1
from 
(select cust_uid from mt_trx_rcd1
wherecust_uid = 'MT10000') b
join 
(select cust_uid as cust_uid_1
from(
	selectcust_uid,mch_nm from mt_trx_rcd1
	where (mch_nm='庄家界(千灯店)'or mch_nm='黄记烘培宫廷桃酥王')
	and cust_uid<>'MT10000'
	group by 1,2
	order by cust_uid
	) a
group by 1
having count(cust_uid)>1) c
2025-08-21 基于共同兴趣爱好的餐厅推荐(3)-好基友(1) 
select a.cust_uid,b.cust_uid_1,a.mch_nm
from
(select distinct cust_uid,mch_nm from mt_trx_rcd1 
where mch_nm ='兰州李晓明拉面馆' and cust_uid ='MT10000') as a
join
(select distinct cust_uid as cust_uid_1,mch_nm from mt_trx_rcd1 
where mch_nm ='兰州李晓明拉面馆' and cust_uid !='MT10000'
order by 1) as b
on a.mch_nm=b.mch_nm
2025-08-21 基于共同兴趣爱好的餐厅推荐(2)-还有谁吃过 
select distinct cust_uid,mch_nm from mt_trx_rcd1
where mch_nm ='兰州李晓明拉面馆'
order by 1
2025-08-21 基于共同兴趣爱好的餐厅推荐(1)-我吃过啥 
select distinct cust_uid,mch_nm from mt_trx_rcd1 
where cust_uid ='MT10000'
order by 2
2025-08-21 基于共同兴趣爱好的餐厅推荐(1)-我吃过啥 
select distinct cust_uid,mch_nm from mt_trx_rcd1 
order by 1