在思考的六边形战士很想去旅行
在思考的六边形战士很想去旅行
全部文章
分类
归档
标签
去牛客网
登录
/
注册
在思考的六边形战士很想去旅行的博客
全部文章
(共90篇)
题解 | 查询成绩
select count(*) -- group by 会压缩行数,直接数行数即可,不用再除以... from ( select sId, avg(score) as avg_score from SC group by sId having avg_score > ...
2025-08-04
1
41
题解 | 请写出计算粉丝ctr的sql语句
# 链式关联 select round(sum(read_num) / sum(show_num), 4) as fans_ctr from c inner join b on c.content_id = b.content_id inner join a on ...
2025-08-04
1
29
题解 | 商品交易(网易校招笔试真题)
# 表意不明的一条题目 select g.id, g.name, g.weight, sum(t.count) as total from goods g inner join trans t on g.id = t.goods_id group b...
2025-08-04
1
37
题解 | 网易云音乐推荐(网易校招笔试真题)
# 请你编写一个SQL,查询向user_id = 1的用户,推荐其关注的人喜欢的音乐。 # 不要推荐该用户已经喜欢的音乐,并且按music的id升序排列。你返回的结果中不应当包含重复项。 -- 基本思路:按要求,选出user_id=1用户的关注者喜欢的音乐,并排除他自己喜欢的音乐 with ...
2025-08-04
1
36
题解 | 网易云音乐推荐(网易校招笔试真题)
# 请你编写一个SQL,查询向user_id = 1的用户,推荐其关注的人喜欢的音乐。 # 不要推荐该用户已经喜欢的音乐,并且按music的id升序排列。你返回的结果中不应当包含重复项。 with s1 as ( select user_id, music_id, musi...
2025-08-04
1
35
题解 | 支付间隔平均值
# 两表取交集,两张表格共有的订单记录才值得计算 # CAST(... AS SIGHED)计算结果消除小数点和小数位 select CAST(avg(abs(timestampdiff(second,o.logtime,s.logtime))) AS SIGNED) as gap from...
2025-08-04
1
28
题解 | 每天登陆最早的用户的内容喜好
# 如果当天出现多个用户同时最早登录,那么这些用户均需要输出 # 此题情况优先考虑窗口函数partition by,而不是group by select a.log_day, a.user_id, u.hobby from ( select log_id, u...
2025-08-04
1
21
题解 | 统计加班员工占比
# 查询后面各种函数嵌套得有点多而已,计算思路清晰的话其实还好 # 计算间隔时长多少个小时,timestampdiff以分钟为单位再除以60,这样相对准确 # 以小时为单位,会出现因取舍导致的误差 select s.department, concat( round(...
2025-08-01
1
40
题解 | 统计各个部门平均薪资
select a.department, round(avg(b.normal_salary-b.dock_salary),3) as avg_salary from staff_tb a left join salary_tb b on a.staff_id = b...
2025-08-01
1
39
题解 | 查询单日多次下订单的用户信息?
select date(order_time) as order_date, o.user_id, count(o.order_id) as order_nums, u.vip from order_tb o left join uservip_tb u ...
2025-08-01
2
38
首页
上一页
1
2
3
4
5
6
7
8
9
下一页
末页