排名

用户解题统计

过去一年提交了

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

收藏

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

评论笔记

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

提交记录

提交日期 题目名称 提交代码
2025-03-23 一线城市历年平均气温 
select	year(dt) as Y,
		cast(avg(case when city = 'beijing' then tmp_h else null end) as decimal(10,2)) as 北京,
cast(avg(case when city = 'shanghai' then tmp_h else null end) as decimal(10,2)) as 上海,
cast(avg(case when city = 'shenzhen' then tmp_h else null end) as decimal(10,2)) as 深圳,
cast(avg(case when city = 'guangzhou' then tmp_h else null end) as decimal(10,2)) as 广州
from weather_rcd_china
where year(dt) between 2011 and 2022
group by Y
order by Y;
2025-03-23 一线城市历年平均气温 
select	year(dt) as Y,
		cast(avg(case when city = 'beijing' then tmp_h else null end) as decimal(10,2)) as 北京,
cast(avg(case when city = 'shanghai' then tmp_h else null end) as decimal(10,2)) as 上海,
cast(avg(case when city = 'shenzhen' then tmp_h else null end) as decimal(10,2)) as 深圳,
cast(avg(case when city = 'guangzhou' then tmp_h else null end) as decimal(10,2)) as 广州
from weather_rcd_china
where year(dt) between 2011 and 2022
group by year(dt)
order by year(dt);
2025-03-23 一线城市历年平均气温 
select year(dt) as Y
    ,cast(avg(case when city='beijing' then tmp_h else null end) as decimal(4,2)) as 北京
    ,cast(avg(case when city='shanghai' then tmp_h else null end) as decimal(4,2)) as 上海
    ,cast(avg(case when city='shenzhen' then tmp_h else null end) as decimal(4,2)) as 深圳
    ,cast(avg(case when city='guangzhou' then tmp_h else null end) as decimal(4,2)) as 广州
from
    weather_rcd_china
where 
    year(dt) between 2011 and 2022
group by 
    year(dt)
2025-03-23 冬季下雪天数 
select	city,
		sum(case when con like '%雪%' then 1 else 0 end) as snowy_days
from weather_rcd_china
where month(dt) in(12, 1, 2)
group by city
order by snowy_days desc;
2025-03-23 条件过滤(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-23 条件过滤(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-23 条件过滤(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-23 条件过滤(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-23 条件过滤(2)半夜活动有猫腻,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) between 1 and 5
order by trx_time;
2025-03-23 条件过滤(1)异地男友有异常,数分闺蜜来帮忙 
select * from cmb_usr_trx_rcd
where	usr_id = '5201314520'
		and 
date(trx_time) between '2024-09-01' and '2024-09-30'
order by	trx_time;
2025-03-23 条件过滤(1)异地男友有异常,数分闺蜜来帮忙 
select * from cmb_usr_trx_rcd
where	usr_id = '5201314520'
		and 
trx_time between '2024-09-01' and '2024-09-30'
order by	trx_time;
2025-03-23 基于共同兴趣爱好的餐厅推荐(1)-我吃过啥 
select cust_uid, mch_nm from mt_trx_rcd1
where cust_uid = 'MT10000'
group by mch_nm
order by mch_nm desc;
2025-03-23 HAVING-语数英优异的学生 
select student_id, sum(score) as total_score from scores
where exam_date = '2024-06-30' and subject in ('语文', '数学', '英语')
group by student_id
having sum(score)>330
order by student_id;
2025-03-23 HAVING-语数英优异的学生 
select student_id, sum(score) as total_score from scores
where exam_date = '2024-06-30' and subject in ('语文', '数学', '英语')
group by student_id
having sum(score)>=330
order by student_id;
2025-03-23 HAVING-语数英优异的学生 
select student_id, sum(score) as total_score from scores
where exam_date = '2024-06-30' and subject in ('语文', '数学', '英语')
group by student_id
having sum(score)>=330
order by total_score;
2025-03-23 HAVING-执教教师超过3人的科目 
select subject from teachers
group by subject
having count(name)>=3 
order by subject;
2025-03-23 HAVING-每次成绩都不低于80分的学生 
select 	student_id, 
		max(score) as max_score, 
min(score) as min_score, 
avg(score) as avg_score 
from scores
group by	student_id
having		min(score)>=80
order by student_id;
2025-03-23 GROUP BY-年龄最大学生的出生日期 
select class_code, min(birth_date) as min_birth_date from students
group by class_code
order by class_code;
2025-03-23 GROUP BY-各科目最高分、最低分 
select subject, max(score) as max_score	, min(score) as min_score from scores
group by subject
order by subject;
2025-03-23 GROUP BY-各科目平均分 
select subject, avg(score) as average_score from scores
where exam_date = '2024-06-30'
group by	subject
order by	subject;