__hello__world
__hello__world
全部文章
分类
归档
标签
去牛客网
登录
/
注册
__hello__world的博客
全部文章
(共24篇)
题解 | 更新员工信息表
SELECT t1.EMPLOYEE_ID, IF ( UPDATE_DT > LAST_UPDATE_DT, NEW_POSITION, POSITION ) AS POSITION, IF ( ...
2025-04-29
0
51
题解 | 未下单用户登陆渠道统计
select channel, count(*) as cnt from user_info u left join order_log o on u.uid = o.uid where order_id is null group by channe...
2025-04-29
2
64
题解 | 未下单用户统计
来,梳理一下清晰的思考过程:【1】明确需求:user_info表是所有注册用户。order_log表是有下过订单的记录。需要找出那些注册了,但从来没在order_log下过单的用户。结果是返回一个数量:cnt。【2】解题思路:用左连接(LEFT JOIN),并筛选右表(order_log)为空的数据...
2025-04-29
1
75
题解 | 输出播放量最高的视频
【1】明确需求:最大播放量:指某个视频在某个时刻,有多少条记录(多少用户)同时在观看它。Top3:找出最大播放量最大的前三个视频。保留三位小数。【2】解决思路整体:因为每个播放记录有 start_time 和 end_time,所以:✅ 如果某个时刻落在 start_time <= 时刻 &l...
2025-04-28
4
123
题解 | 每个顾客购买的最新产品名称
select customer_id, customer_name, product_name as latest_order from ( select o.customer_id, c.custome...
2025-04-28
0
50
题解 | 各个部门实际平均薪资和男女员工实际平均薪资
SELECT department, ROUND(AVG(actual_salary), 2) AS average_actual_salary, ROUND( IFNULL( AVG(CASE WHEN staff_gender =...
2025-04-28
0
62
题解 | 统计每个产品的销售情况
#顾客年龄分层并查询购买数量最多顾客 with t1 as (select c.customer_id, customer_name, product_id, case ...
2025-04-24
0
69
题解 | 每个顾客最近一次下单的订单信息
select order_id, customer_name, order_date from ( select order_id, customer_name, order_da...
2025-04-22
0
50
题解 | 查询订单
select aa.order_id, aa.customer_name, aa.order_date from ( select o.order_id, c.customer_name, ...
2025-04-22
0
63
题解 | 每个部门薪资排名前两名员工
select department,employee_name,salary from( select department,employee_name,salary,row_number() over (partition by department order by department des...
2025-04-22
0
60
首页
上一页
1
2
3
下一页
末页