GuaMiao
GuaMiao
全部文章
分类
归档
标签
去牛客网
登录
/
注册
GuaMiao的博客
全部文章
(共89篇)
题解 | #窗口函数三个排序函数的区别与使用
select emp_no, salary, DENSE_RANK() OVER (ORDER BY salary desc) as t_rank from salaries order by salary desc, emp_no;
2023-08-19
0
328
题解 | #汇总各个部门当前员工的title类型的分配数目#
with t1 as ( select a.emp_no, a.dept_no, b.dept_name from dept_emp as a left join departments as b on a.dept_no = b.dept_no ) select t...
2023-08-18
0
267
题解 | #牛客每个人最近的登录日期(二)#
with t1 as ( select user_id, max(date) as date from login group by user_id ), # 在这里我刚开始直接用的date in (select date from t1),这样是不对的,应该使用连接,连接的...
2023-08-18
1
445
题解 | #考试分数(四)# 考察MOD取余判断奇偶
with t1 as ( select job, count(score) as cnt from grade group by job ) select job, (case when MOD(cnt, 2) = 0 then round(cnt/2,0) else CEI...
2023-08-17
0
287
题解 | #考试分数(三)#
with t1 as ( select a.id, b.name, a.score from grade as a left join language as b on a.language_id = b.id ), # 按照name进行分组,然后按照score降序进...
2023-08-17
0
374
题解 | #月均完成试卷数不小于3的用户爱作答的类别#
# count不会将空值记录进去 # 计算月均完成试卷数,等于总完成试卷数/多少各月份 # t1先计算总的完成数量和总共占多少月份 with t1 as ( select uid, count(score) as total_cnt, count(distinct DATE...
2023-08-16
0
246
题解 | #只出现一次的牛II#python哈希表
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param nums int整型一维数组 # @return int整型一维数组 # class Solution: def findSingleCowsII(self , nums: Lis...
2023-08-15
0
237
题解 | #注册当天就完成了试卷的名单第三页#
with t1 as ( select uid, register_time from user_info where job = '算法' ), t2 as ( select a.uid, a.exam_id, a.start_time, a.submit_time...
2023-08-13
0
334
题解 | #筛选限定昵称成就值活跃日期的用户#
# 先找到昵称符合条件的用户uid with t1 as ( select uid, nick_name, achievement from user_info where nick_name REGEXP '^牛客[0-9]*号$' and achievement ...
2023-08-13
0
348
题解 | #各用户等级的不同得分表现占比#
# 先找出完成过试卷的用户uid with t1 as ( select a.uid, b.level, a.score from exam_record as a left join user_info as b on a.uid = b.uid ), # 将各个分...
2023-08-13
0
350
首页
上一页
1
2
3
4
5
6
7
8
9
下一页
末页