stf666
stf666
全部文章
分类
归档
标签
去牛客网
登录
/
注册
stf666的博客
全部文章
(共55篇)
题解 | 查询出每个品牌在特定时间段内的退货率以及平均客户满意度评分
select b.brand_id ,brand_name ,round(sum(return_status)/count(return_status),2) as return_rate_July_2024 ,round(avg(customer_satisfaction_score),2) as...
2025-10-29
0
21
题解 | 分析每个员工在不同项目中的绩效情况
/*处理2024上半年*/ with project as ( select * from projects where substring(start_date, 1, ...
2025-10-29
0
24
题解 | 查询出不同类别商品中,销售金额排名前三且利润率超过 20%的商品信息
with details as ( select p.product_id ,product_name ,category_id ,sales_amount ,cost_amount ,row_number() over(partition by ca...
2025-10-29
0
20
题解 | 分析每个商品在不同时间段的销售情况
/*处理第二季度*/ with order_underline as ( select * from order_info where substring(order_date,1,4) = "2024" and substring(order_d...
2025-10-29
0
23
题解 | 电商平台想要了解不同商品在不同月份的销售趋势
/*没有输出是因为时间处理不当,答案错误是因为销量全部计算为销售额! 这里时间是字符串类型,不能直接用函数取年份和月份!!!*/ /*处理一下总表*/ with details as ( select p.product_id ,product_name ,substrin...
2025-10-29
0
23
题解 | 电商平台需要对商家的销售业绩、退款情况和客户满意度进行综合评估
select distinct t1.merchant_id ,t1.merchant_name ,s.total_sales_amount ,r.total_refund_amount ,round(t.avg_satisfaction_score,2) as average_satisfacti...
2025-10-27
0
26
题解 | 对商品的销售情况进行深度分析
/*当颗粒度不同时,用聚合函数会更方便一些,有计算排名百分比的也用聚合函数*/ /*每类产品的总销售额,注意是每类产品不是每个产品*/ with totalsales as ( select category ,sum(quantity * price) over(partition...
2025-10-26
0
17
题解 | 最受欢迎的top3课程
with details as ( select t.cid, pv, time_len, row_number() over ( /*窗口函数只能出现在子查询,分布查询或者ord...
2025-10-23
0
31
题解 | 更新员工信息表
with t1 as ( select EMPLOYEE_ID, NEW_POSITION, UPDATE_DT, row_number() over(partition by E...
2025-10-23
0
36
题解 | 未下单用户登陆渠道统计
/*where和having都不支持使用窗口函数语句或别名,因为SQL执行顺序是from/join--where--group by--having--select--order by,因此要使用窗口函数别名只能创建子查询或者同cte分布查询 */ /*子查询 select tt.channel ...
2025-10-23
0
24
首页
上一页
1
2
3
4
5
6
下一页
末页