牛客987852806号
牛客987852806号
全部文章
分类
题解(45)
归档
标签
去牛客网
登录
/
注册
牛客987852806号的博客
全部文章
(共163篇)
题解 | #第二快/慢用时之差大于试卷时长一半的试卷#
with tiaojian as ( select t.exam_id, sum(case when t.m=2 then diff when t.d=2 then -diff end)/60 as pt from( select exam_id, timestampdiff(second,star...
2023-05-23
1
300
题解 | #每个6/7级用户活跃情况#
with tiaojian as ( select uid from user_info where level in (6,7) ), tiaojian1 as ( select uid,exam_id,"exam_id" as pt,date(submit_time) as pday,date_...
2023-05-23
1
242
题解 | #分解题目,小白写法,容易理解,请大牛多多指教#
#1.思路 先求出每个用户每天做的题数的具体的author_id用户ID,at.author_level用户等级,ab.answer_date,目的, #在求连续天数的时候,确保每个用户都可以满足当天做题大于1的条件 select ab.author_id, at.author_level, ab....
2023-03-30
1
331
题解 | #未完成率较高的50%用户近三个月答卷情况#
#注意sql试卷是限制未完成率排名 #6,7级用户是限制做题记录 #想喊个破题,同时筛选就报错,然后,先筛选出SQL和完成数及做题数的总占比(类似总数 100 A 50 B 20 C30 就分别为总占比50% 20% 和 30%)这个小于50%先筛选出来,总占比函数percent_rank()ove...
2023-03-29
1
346
题解 | #试卷完成数同比2020年的增长率及排名变化#
select t.tag, sum(case when t.years=2020 then t.m end), sum(case when t.years=2021 then t.m end), concat( round( ((sum(case when t.years=2021 then t.m...
2023-03-29
1
305
题解 | #牛客网每日正确与错误的答题次数#
import sys import pandas as pd for line in sys.stdin: a = line.split() print(int(a[0]) + int(a[1])) f=pd.read_csv("nowcoder.csv",sep=",") f1...
2023-02-20
1
384
题解 | #查找在职员工自入职以来的薪水涨幅情况#
#思路,我们可以求出入职的时候的工资,也就是按照emp_no分组,时间升序第一个的工资,在求一个emp_no分组的时间降序的工资,作为最近工资,相减就是答案,当然,我们要考虑,to_date="9999-01-01"的要求,所有,我们增加子查询,找到那些符合to_date="9999-01-01"的...
2023-02-17
1
298
题解 | #每份试卷每月作答数和截止当月的作答总数。#
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
257
题解 | #每个年龄的学生在各学校最大数量#
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
353
题解 | #找出每个学校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
268
首页
上一页
7
8
9
10
11
12
13
14
15
16
下一页
末页