牛客987852806号
牛客987852806号
全部文章
分类
题解(45)
归档
标签
去牛客网
登录
/
注册
牛客987852806号的博客
全部文章
(共166篇)
题解 | #每份试卷每月作答数和截止当月的作答总数。#
select exam_id, date_format(start_time,"%Y%m") as month, count(id), sum(count(id))over(partition by exam_id order by date_format(start_time,"%Y%m") ) ...
2023-02-15
0
266
题解 | #每个年龄的学生在各学校最大数量#
select distinct t.age, t.max_cnt from( select age, count(id) as max_cnt, dense_rank()over(partition by age order by count(id) desc) as pt from user_p...
2023-02-09
0
364
题解 | #找出每个学校GPA最低的同学#
select t.device_id, t.university, t.gpa from( select device_id, university, gpa, dense_rank()over(partition by university order by gpa asc) as m fr...
2023-02-09
0
279
题解 | #计算用户的平均次日留存率#
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
387
题解 | 就这样吧,可以简化很多,犯懒了,不简化了,作差方式
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
300
题解 | 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
360
题解 | #国庆期间近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
282
题解 | #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
311
题解 | #试卷完成数同比2020年的增长率及排名变化#
萌新解题思路。 1.求出每年,每个科目的的完成数(虚拟表) 2.在读取虚拟表去,得到想要的数据, with tiaojian as ( select ef.tag, #科目 year(ed.start_time) as years,#提取科目的那一年 count(ed.id) as...
Mysql
2022-07-06
0
305
题解 | #每天的日活数及新用户占比#
采用虚拟表做的,可拓展空间大。请大佬多多指教,先做出来最早登录的时间和人,在求出来每天登录时间的和人(虚拟表) 在求出来两个虚拟表相连,并把条件写出来因注册日=注册日,所以,要建立相连。再求出来注册人数,用count(distinct uid)求出来当天活跃人数 一除以就行了 with&nb...
Mysql
2021-12-29
1
440
首页
上一页
8
9
10
11
12
13
14
15
16
17
下一页
末页