yyyy11一
yyyy11一
全部文章
分类
归档
标签
去牛客网
登录
/
注册
yyyy11一的博客
全部文章
(共87篇)
题解 | 分析每个商品在不同时间段的销售情况
SELECT t1.product_id, t1.product_name, t1.q2_2024_sales_total, DENSE_RANK() OVER (PARTITION BY t1.category ORDER BY t1.q2_2024_sales_total DES...
2026-01-03
0
50
题解 | 商品id数据清洗统计
select substr(order_id,6,4) product_id,count(*) cnt from order_log group by substr(order_id,6,4) order by cnt limit 1
2025-12-28
1
45
题解 | 每个顾客购买的最新产品名称
SELECT t1.customer_id, c.customer_name, p.product_name AS latest_order FROM ( SELECT customer_id, MAX(order_date) A...
2025-12-27
0
37
题解 | 每个顾客购买的最新产品名称
SELECT o.customer_id, c.customer_name, p.product_name AS latest_order FROM ( -- 关键补充:主查询需要FROM关键字来关联子查询T1 SELECT customer_i...
2025-12-27
0
57
题解 | 输出播放量最高的视频
select cid,round(cast(max(t1) as FLOAT),3) t4--cast as FLOAT转换成浮点型 from (select a.cid,sum(if(a.start_time between b.start_time and b.end_time,1,0)) t1...
2025-12-26
0
47
题解 | 统计每个产品的销售情况
with total_sales as (select o.product_id,round(sum(o.quantity*p.unit_price),2) as total_sales,p.unit_price,sum(o.quantity) as total_quantity, round(s...
2025-12-25
0
31
题解 | 每个顾客最近一次下单的订单信息
select order_id, customer_name, order_date from ( select o.order_id, c.customer_name, o.order_date, row_number() over(partition by c.cu...
2025-12-25
0
36
题解 | 商品销售总额分布
SELECT CASE WHEN pay_method = '' THEN 'error' ELSE pay_method END, COUNT(*) AS pay_method_count -- 统计订单数(含非NULL支付方式) FROM...
2025-12-24
0
29
题解 | 统计创作者
SELECT a.author_id, a.author_name, COUNT(*) posts_30d, SUM(like_cnt) likes_30d, ROUND(IFNULL(SUM(like_cnt)/COUNT(*),0), 2) avg_li...
2025-12-23
0
25
题解 | 商品价格排名
select product_id, product_name, type, price from ( select product_id, product_name, type, pric...
2025-12-22
0
30
首页
上一页
1
2
3
4
5
6
7
8
9
下一页
末页