不精独乐乐
不精独乐乐
全部文章
分类
归档
标签
去牛客网
登录
/
注册
不精独乐乐的博客
全部文章
(共156篇)
题解 | #获得积分最多的人(二)#
select id, name, sum_g from( select *, rank()over(order by sum_g desc) as r from( select distinct id, name, sum(grade_num)over(partition by name) as ...
2023-02-27
0
192
题解 | #获得积分最多的人(一)#
with tb1 as( select name, sum(grade_num) g from grade_info left join user on grade_info.user_id=user.id group by name) select name, g from tb1 where...
2023-02-25
0
170
题解 | #最差是第几名(二)#
自己的代码弱爆了,就不写思路了。牛逼的代码可以参考高赞回答。 select grade from( select grade, if(c >bb and c<=b or d>bb and c<=b,1,0) as e from( select grade, lag(b,1)o...
2023-02-25
0
203
题解 | #实习广场投递简历分析(三)#
注意:日期用date_format后就不是日期格式了,而是字符串格式,不能用来算时间差。 思路:①准备一张25年、26年的表,tb1;②再准备一张只有25年的表,tb2;③tb2左连tb1,连接条件是月份相当,年份差1。 with tb1 as ( select job, date_for...
2023-02-24
0
238
题解 | #实习广场投递简历分析(一)#
select job, sum(num) as cnt from resume_info where date_format(date,'%Y')>2024 and date_format(date,'%Y')<=2025 group by job order by cnt desc
2023-02-23
0
227
题解 | #牛客的课程订单分析(七)#
思路:先筛数据形成tb1,再找出购买≥2次的人所对应的数据形成tb2, 最后将name里null的部分换成GroupBuy即可。 with tb1 as( select user_id, name from order_info left join client on order_info....
2023-02-23
0
254
题解 | #牛客的课程订单分析(六)#
思路:①两表连接,用非聚合的筛选条件完成数据筛选,形成tb1;②基于tb1,选出购买数量≥2的用户所在行数据即可。 with tb1 as( select order_info.id as id, user_id, is_group_buy, name from order_info...
2023-02-22
2
191
题解 | #牛客的课程订单分析(五)#
思路:①先在原表date后面增加一列下偏移日期,即把后一次购买的日期移到本行记为r,用窗口函数lead,形成表tb1; ②在tb1基础上选出最小日期min(date)、最小后一次购买日期min(r)即可。 select user_id, min(date), min(r), min(cnt) fro...
2023-02-21
0
269
题解 | #牛客的课程订单分析(四)#
select distinct user_id, min(date), count(user_id) from order_info where date>'2025-10-15' and status='completed' and product_name in ('C++','Java'...
2023-02-21
0
197
题解 | #牛客的课程订单分析(三)#
思路:①根据非聚合类的筛选条件建表tb1(如2025-10-15以后、购买课程为JAVA/C++、必须完成购买为非聚合筛选); ②基于tb1,根据聚合筛选条件(成功购买2次以上)筛出user_id形成tb2; ③将tb2左连接tb1即可。 with tb1 as ( select * from or...
2023-02-21
0
189
首页
上一页
6
7
8
9
10
11
12
13
14
15
下一页
末页