GuaMiao
GuaMiao
全部文章
分类
归档
标签
去牛客网
登录
/
注册
GuaMiao的博客
全部文章
(共92篇)
题解 | 原字符串长度-逗号替换为空字符串后的字符串长度
select id, LENGTH(string)-LENGTH(REPLACE(string,',','')) as cnt from strings;
2023-08-31
0
336
题解 | #分页查询employees表,
# 也就是需要返回6到10行的数据 select * from employees limit 5, 5;
2023-08-31
0
378
题解 | #考试分数(二)#
# 先找到每一个工作的平均分 with t1 as ( select job, AVG(score) as avg_score from grade group by job ) select id, job, score from ( select a.*, t1....
2023-08-30
0
388
题解 | #最差是第几名(一)#
select grade, SUM(number) OVER (order by grade) as total_number from class_grade;
2023-08-30
0
263
题解 | #最差是第几名(二)#又臭又长的代码来咯
# 先找到中位数的初始位置 # 注意round是四舍五入 with t1 as ( select (case when MOD(sum(number), 2) = 0 then round(sum(number)/2, 0) else round(sum(number)/2, 0) end ...
2023-08-30
1
367
题解 | #获取有奖金的员工相关信息。#
with t1 as ( select a.emp_no, a.recevied, b.first_name, b.last_name, a.btype from emp_bonus as a left join employees as b on a.emp_no ...
2023-08-29
0
357
题解 | #牛客的课程订单分析(二)#
with t1 as ( select user_id, product_name from order_info where date > '2025-10-15' and status = 'completed' and product_name i...
2023-08-26
0
296
题解 | #获得积分最多的人(一)#
with t1 as ( select a.name, (case when b.type = 'add' then b.grade_num else -b.grade_num end ) as grade_change from grade_info as b le...
2023-08-26
0
370
题解 | #获得积分最多的人(二)#
# 运用左连接将每一个用户的积分变化记录查找出来 with t1 as ( select user_id as id, b.name, (case when a.type = 'add' then grade_num else -grade_num end) as jifen_cha...
2023-08-23
0
417
题解 | #网易云音乐推荐(网易校招笔试真题)#
# 找到user_id = 1关注的用户 with t1 as ( select follower_id from follow where user_id = 1 ), # 找到他关注的用户喜欢的音乐 t2 as ( select t1.follower_id, a.music_id from t...
2023-08-23
0
381
首页
上一页
1
2
3
4
5
6
7
8
9
10
下一页
末页