排名

用户解题统计

过去一年提交了

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

收藏

收藏日期 题目名称 解决状态
2025-05-26 查询播放量为0的歌手及其专辑  未解决
2025-05-26 小结-行转列,展开学生成绩(1)  已解决

评论笔记

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

提交记录

提交日期 题目名称 提交代码
2025-05-26 用户听歌习惯的时间分布 
select user_id,  DAYNAME(start_time)day_of_week,count(if_finished)listens_per_day
from listen_rcd
group by user_id,day_of_week
order by user_id,day_of_week
2025-05-26 用户听歌习惯的时间分布 
select user_id,  DAYNAME(start_time)day_of_week,sum(if_finished)listens_per_day
from listen_rcd
group by user_id,day_of_week
order by user_id,day_of_week
2025-05-26 数学成绩分段统计(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 
    students s
JOIN 
    scores sc ON s.student_id = sc.student_id
WHERE 
    sc.subject = '数学' 
    AND sc.exam_date = '2024-06-30'
GROUP BY 
    score_range
ORDER BY 
    score_range DESC;
2025-05-26 曝光量最大的商品 
select r.prd_id,m.prd_nm,sum(if_snd)exposure_count
from tb_pg_act_rcd r
join tb_prd_map m using(prd_id)
group by prd_id,prd_nm
order by exposure_count desc
limit 1
2025-05-26 查询所有终点是餐饮类地点的行程记录 
select cust_uid	,start_loc	,end_loc	,start_tm,car_cls
from didi_sht_rcd d
join loc_nm_ctg l on d.end_loc=l.loc_nm 
where l.loc_ctg="餐饮"
order by start_tm
2025-05-26 不分类别的最火直播间 
selectt1.live_id	,t2.live_nm, count(distinct usr_id)enter_cnt
from ks_live_t1 t1
join ks_live_t2t2 using(live_id)
where time(enter_time)<="23:59:59" and time(enter_time)>="23:00:00"
group by live_nm,t1.live_id
order by enter_cnt desc
limit 5
2025-05-26 不分类别的最火直播间 
selectt1.live_id	,t2.live_nm, count(distinct usr_id)enter_cnt
from ks_live_t1 t1
join ks_live_t2t2 using(live_id)
where time(enter_time)<"23:59:59" and time(enter_time)>"23:00:00"
group by live_nm,t1.live_id
order by enter_cnt desc
limit 5
2025-05-26 文科潜力股 
select*
from scores
where 
    (
      (subject = '历史' and score >= 90)
    or (subject = '地理' and score >= 90)
    or (subject = '政治' and score >= 90)
       )
    and exam_date='2024-06-30'
order by score desc ,student_id,subject
2025-05-26 给英语成绩中上水平的学生拔尖 
select*
from scores
where subject="英语" and( score between 100 and 110) and exam_date="2024-06-30"
2025-05-26 找出三个班级的女生 
select*
from students
where gender="f"and class_code in('C219','C220','C221')
2025-05-26 语文数学英语至少1门超过100分的同学 
select student_id,chinese,math,english
from subject_score
where chinese>100 or math >100 or english>100
2025-05-26 小结-行转列,展开学生成绩(1) 
select exam_date, MAX(CASE WHEN subject = '语文' THEN score ELSE NULL END) AS chinese_score,
    MAX(CASE WHEN subject = '数学' THEN score ELSE NULL END) AS math_score,
    MAX(CASE WHEN subject = '英语' THEN score ELSE NULL END) AS english_score
from scores
WHERE student_id = 460093 AND subject IN ('语文', '数学', '英语')
group by exam_date
order by exam_date
2025-05-26 HAVING-语数英优异的学生 
select student_id,	sum(score)total_score
from scores
where exam_date='2024-06-30'and subject IN ('语文', '数学', '英语')
group by student_id
having sum(score)>330
2025-05-26 HAVING-语数英优异的学生 
select student_id,	sum(score)total_score
from scores
where exam_date='2024-06-30'
group by student_id
having sum(score)>330
2025-05-26 HAVING-执教教师超过3人的科目 
select subject 
from teachers
 group by subject
 having count(*)>=3
2025-05-26 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-05-26 CASE WHEN-老中青教师数量 
select (case when year(enter_date)>=2010 then "青年教师"
 when year(enter_date)<2000 then "资深教师" 
 else "中年教师"end )as teacher_type,	count(*)teacher_count
from teachers
group by teacher_type
2025-05-26 CASE WHEN-男女学生的数量 
select if(gender="m","男",'女')as gender_text ,count(1)student_count
from students
group by gender
2025-05-26 聚合函数-比较两位同学的数学成绩 
select student_id,max(score)max_score,min(score)	min_score,avg(score)	avg_score
from scores
where (student_id=460093 or student_id=735011)and subject='数学'
group by student_id
2025-05-26 聚合函数-比较两位同学的数学成绩 
select max(score)max_score,min(score)	min_score,avg(score)	avg_score
from scores
where (student_id=460093 or student_id=735011)and subject='数学'
group by student_id