牛客987852806号
牛客987852806号
全部文章
分类
题解(45)
归档
标签
去牛客网
登录
/
注册
牛客987852806号的博客
全部文章
(共163篇)
题解 | #计算用户的平均次日留存率#
select sum(case when datediff(t1.m,t1.date) =1 then 1 else 0 end) /count( device_id) from( select t.device_id, t.date, lead(t.date,1)over(partition by...
2023-02-09
0
371
题解 | 就这样吧,可以简化很多,犯懒了,不简化了,作差方式
select t1.author_id, ab.author_level, t1.pt from( select t.author_id, count(*) as pt from( select author_id, answer_date, row_number()over(partition b...
2023-02-06
1
285
题解 | SQL啰嗦了点,但是容易看懂
select count(distinct ab.author_id) from answer_tb ab left join issue_tb i on ab.issue_id=i.issue_id where i.issue_type="Career" and ab.author_id i...
2023-02-06
0
348
题解 | #国庆期间近7日日均取消订单量#
select t1.pday, round( t1.pwc,2), round( t1.pqx,2) from( select t.pday, avg(t.wc)over(order by t.pday range interval 6 day PRECEDING) as pwc,#求每日完成单前7...
2023-01-04
0
269
题解 | #0级用户高难度试卷的平均用时和平均得分#
select ed.uid, round( avg(case when submit_time is null then 0 else ed.score end), #如果submit_time 为空的话,则值为0,进行平均值计算 0), round( avg(case when sub...
Mysql
2022-07-08
0
299
题解 | #试卷完成数同比2020年的增长率及排名变化#
萌新解题思路。 1.求出每年,每个科目的的完成数(虚拟表) 2.在读取虚拟表去,得到想要的数据, with tiaojian as ( select ef.tag, #科目 year(ed.start_time) as years,#提取科目的那一年 count(ed.id) as...
Mysql
2022-07-06
0
284
题解 | #每天的日活数及新用户占比#
采用虚拟表做的,可拓展空间大。请大佬多多指教,先做出来最早登录的时间和人,在求出来每天登录时间的和人(虚拟表) 在求出来两个虚拟表相连,并把条件写出来因注册日=注册日,所以,要建立相连。再求出来注册人数,用count(distinct uid)求出来当天活跃人数 一除以就行了 with&nb...
Mysql
2021-12-29
1
432
题解 | #统计活跃间隔对用户分级结果#
SELECT t.grade, round( count(t.uid)/(select count(distinct uid) from tb_user_log),2) as cnt FROM( select uid, case when datediff(date((select max(in_...
Mysql
2021-12-29
0
411
题解 | #2021年11月每天新用户的次日留存率#
小白 实际工作中的思路做法,请大牛们多多指教。 利用,虚拟表把每位UID最早的登录时间查出来(表1),在用虚拟表把所有信息时间保存出来,因为有一条件24时之后也算之前的活跃度,所以要考虑到end所以2个时间合并,且重复不合并用union 之后,取出最早时间,用户登录时间,时间...
Mysql
2021-12-23
1
464
题解 | #SQL类别高难度试卷得分的截断平均值#
SELECT t.tag, t.difficulty, round( avg(t.score),1) from ( select e2.tag, e2.difficulty, e1.score, dense_rank()over(order by e1.score desc) as m , dens...
Mysql
2021-11-03
0
386
首页
上一页
8
9
10
11
12
13
14
15
16
17
下一页
末页