排名

用户解题统计

过去一年提交了

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

收藏

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

评论笔记

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

提交记录

提交日期 题目名称 提交代码
2026-04-08 抖音面试真题(1)T+1日留存率 
select x1.login_date,concat(round((x1.T1_retention/x1.T1_retention_last-1)*100,2),'%') as t1_retention_rate from (
select x.login_date,x.T1_retention,lag(x.T1_retention) over(order by x.login_date) as T1_retention_last from (
select cast(t.login_time as date) as login_date,count(distinct t.usr_id) as T1_retention from user_login_log t
where cast(t.login_time as date) between date_sub(current_date(),interval 31 day) and current_date()
group by cast(t.login_time as date)
)x 
)x1 
 where x1.T1_retention_last is not null 
 ;
2026-04-07 一线城市历年平均气温 
SELECT X.Y
 ,MAX(CASE WHEN X.CITY='beijing' THEN X.TMPEND) AS 北京
 ,MAX(CASE WHEN X.CITY='shanghai' THEN X.TMP END) AS 上海
 ,MAX(CASE WHEN X.CITY='shenzhen' THEN X.TMP END) AS 深圳 
 ,MAX(CASE WHEN X.CITY='guangzhou' THEN X.TMP END) AS广州
from(
SELECT t.cityAS CITY,
 YEAR(t.dt) AS Y,
 CAST(ROUND(AVG(t.tmp_h), 2) AS DECIMAL(10,2)) AS TMP
FROM weather_rcd_china t
WHERE cast(t.dt as date) BETWEEN '2011-01-01' AND '2022-12-31'
GROUP BY t.city, YEAR(t.dt)
) X
 GROUP BY X.Y
 order by X.Y ;
2026-04-07 一线城市历年平均气温 
SELECT X.Y
 ,MAX(CASE WHEN X.CITY='beijing' THEN CAST(X.TMP AS DECIMAL(10,2)) END) AS 北京
 ,MAX(CASE WHEN X.CITY='shanghai' THEN CAST(X.TMP AS DECIMAL(10,2)) END) AS 上海
 ,MAX(CASE WHEN X.CITY='shenzhen' THEN CAST(X.TMP AS DECIMAL(10,2)) END) AS 深圳 
 ,MAX(CASE WHEN X.CITY='guangzhou' THEN CAST(X.TMP AS DECIMAL(10,2)) END) AS广州
			from(
SELECT t.cityAS CITY,
 YEAR(t.dt) AS Y,
 round(AVG(t.tmp_h),2) AS TMP
FROM weather_rcd_china t
WHERE cast(t.dt as date) BETWEEN '2011-01-01' AND '2022-12-31'
GROUP BY t.city, YEAR(t.dt)
) X
 GROUP BY X.Y
 order by X.Y ;
2026-04-07 一线城市历年平均气温 
SELECT X.Y
 ,MAX(CASE WHEN X.CITY='beijing' THEN CAST(X.TMP AS DECIMAL(10,2)) END) AS 北京
 ,MAX(CASE WHEN X.CITY='shanghai' THEN CAST(X.TMP AS DECIMAL(10,2)) END) AS 上海
 ,MAX(CASE WHEN X.CITY='shenzhen' THEN CAST(X.TMP AS DECIMAL(10,2)) END) AS 深圳 
 ,MAX(CASE WHEN X.CITY='guangzhou' THEN CAST(X.TMP AS DECIMAL(10,2)) END) AS广州
			from(
SELECT t.cityAS CITY,
 YEAR(t.dt) AS Y,
 round(AVG(t.tmp_h),2) AS TMP
FROM weather_rcd_china t
WHERE t.dt BETWEEN '2011-01-01' AND '2022-12-31'
GROUP BY t.city, YEAR(t.dt)
) X
 GROUP BY X.Y
 order by X.Y ;
2026-04-07 一线城市历年平均气温 
SELECT X.Y
 ,MAX(CASE WHEN X.CITY='beijing' THEN X.TMP END) AS 北京
 ,MAX(CASE WHEN X.CITY='shanghai' THEN X.TMP END) AS 上海
 ,MAX(CASE WHEN X.CITY='shenzhen' THEN X.TMP END) AS 深圳 
 ,MAX(CASE WHEN X.CITY='guangzhou' THEN X.TMP END) AS广州
			from(
SELECT t.cityAS CITY,
 YEAR(t.dt) AS Y,
 round(AVG(t.tmp_h),2) AS TMP
FROM weather_rcd_china t
WHERE t.dt BETWEEN '2011-01-01' AND '2022-12-31'
GROUP BY t.city, YEAR(t.dt)
) X
 GROUP BY X.Y
 order by X.Y ;
2026-04-07 一线城市历年平均气温 
SELECT X.Y
 ,MAX(CASE WHEN X.CITY='beijing' THEN X.TMP END) AS 北京
 ,MAX(CASE WHEN X.CITY='chengdu' THEN X.TMP END) AS 上海
 ,MAX(CASE WHEN X.CITY='shenzhen' THEN X.TMP END) AS 深圳 
 ,MAX(CASE WHEN X.CITY='guangzhou' THEN X.TMP END) AS广州
			from(
SELECT t.cityAS CITY,
 YEAR(t.dt) AS Y,
 round(AVG(t.tmp_h),2) AS TMP
FROM weather_rcd_china t
WHERE t.dt BETWEEN '2011-01-01' AND '2022-12-31'
GROUP BY t.city, YEAR(t.dt)
) X
 GROUP BY X.Y
 order by X.Y ;
2026-04-07 一线城市历年平均气温 
SELECT X.Y
 ,MAX(CASE WHEN X.CITY='beijing' THEN X.TMP END) AS 北京
 ,MAX(CASE WHEN X.CITY='chengdu' THEN X.TMP END) AS 成都
 ,MAX(CASE WHEN X.CITY='shenzhen' THEN X.TMP END) AS 深圳 
 ,MAX(CASE WHEN X.CITY='changsha' THEN X.TMP END) AS长沙
 ,MAX(CASE WHEN X.CITY='kunming' THEN X.TMP END) AS 昆明
			from(
SELECT t.cityAS CITY,
 YEAR(t.dt) AS Y,
 round(AVG(t.tmp_h),2) AS TMP
FROM weather_rcd_china t
WHERE t.dt BETWEEN '2011-01-01' AND '2022-12-31'
GROUP BY t.city, YEAR(t.dt)
) X
 GROUP BY X.Y
 order by X.Y ;
2026-04-07 一线城市历年平均气温 
SELECT X.Y
 ,MAX(CASE WHEN X.CITY='beijing' THEN X.TMP END) AS 北京
 ,MAX(CASE WHEN X.CITY='chengdu' THEN X.TMP END) AS 成都
 ,MAX(CASE WHEN X.CITY='shenzhen' THEN X.TMP END) AS 深圳 
 ,MAX(CASE WHEN X.CITY='changsha' THEN X.TMP END) AS长沙
 ,MAX(CASE WHEN X.CITY='kunming' THEN X.TMP END) AS昆明
			from(
SELECT t.cityAS CITY,
 YEAR(t.dt) AS Y,
 round(AVG(t.tmp_h),2) AS TMP
FROM weather_rcd_china t
WHERE t.dt BETWEEN '2011-01-01' AND '2022-12-31'
GROUP BY t.city, YEAR(t.dt)
) X
 GROUP BY X.Y
 order by X.Y ;
2026-04-07 一线城市历年平均气温 
SELECT X.Y
 ,CASE WHEN X.CITY='北京' THEN X.TMP END AS 北京
 ,CASE WHEN X.CITY='成都' THEN X.TMP END AS 成都
 ,CASE WHEN X.CITY='深圳' THEN X.TMP END AS 深圳 
 ,CASE WHEN X.CITY='长沙' THEN X.TMP END AS 长沙
 ,CASE WHEN X.CITY='昆明' THEN X.TMP END AS 昆明
			from(
SELECT case when t.city='beijing' THEN '北京'
			when t.city='chengdu' THEN '成都' 
when t.city='changsha' THEN '长沙'
			when t.city='kunming' THEN '昆明' 
			when t.city='shenzhen' THEN '深圳'
			ELSE t.city END AS CITY,
 YEAR(t.dt) AS Y,
 round(AVG(t.tmp_h),2) AS TMP
FROM weather_rcd_china t
WHERE t.dt BETWEEN '2011-01-01' AND '2022-12-31'
GROUP BY t.city, YEAR(t.dt)
) X
 order by X.Y ;