微信扫码
添加专属顾问
我要投稿
-- 订单表 CREATE TABLE orders ( order_id INT PRIMARY KEY, product_name VARCHAR(255), order_date DATE, quantity INT );
SELECT SUM(quantity) AS total_orders FROM orders WHERE product_name = 'xx产品' AND order_date >= CURDATE() - INTERVAL 7 DAY;
SELECT SUM(quantity) AS total_sales FROM orders WHERE product_name = 'xx产品' AND YEAR(order_date) = YEAR(CURDATE());
-- 国内销售表 CREATE TABLE domestic_sales ( product_name VARCHAR(255), sales_count INT ); -- 国外销售表 CREATE TABLE international_sales ( product_name VARCHAR(255), sales_count INT );
SELECT SUM(ds.sales_count) AS domestic_sales, SUM(is.sales_count) AS international_sales FROM domestic_sales ds, international_sales is WHERE ds.product_name = 'xx品牌' AND is.product_name = 'xx品牌';
WITH sales_data AS ( SELECT product_name, SUM(quantity) AS total_sales FROM orders WHERE product_name = 'xx品牌' AND order_date >= CURDATE() - INTERVAL 3 MONTH GROUP BY product_name ), ranked_sales AS ( SELECT product_name, total_sales, RANK() OVER (ORDER BY total_sales DESC) AS sales_rank FROM sales_data ) SELECT product_name, total_sales / 3 AS avg_monthly_sales FROM ranked_sales WHERE sales_rank = 1;
-- 假设有一张效率表CREATE TABLE efficiency ( region VARCHAR(255), product_name VARCHAR(255), efficiency_value DECIMAL(10,2), month DATE ); -- 查询效率环比下降的原因WITH current_month AS ( SELECT efficiency_value FROM efficiency WHERE region = '华北' AND product_name = 'xx' AND month = CURDATE() - INTERVAL 1 MONTH ), previous_month AS ( SELECT efficiency_value FROM efficiency WHERE region = '华北' AND product_name = 'xx' AND month = CURDATE() - INTERVAL 2 MONTH ) SELECT cm.efficiency_value - pm.efficiency_value AS efficiency_drop FROM current_month cm, previous_month pm;
53AI,企业落地大模型首选服务商
产品:场景落地咨询+大模型应用平台+行业解决方案
承诺:免费POC验证,效果达标后再合作。零风险落地应用大模型,已交付160+中大型企业
2025-08-28
阿里巴巴发布首个数据分析Agent,让人人都可拥有AI分析师
2025-08-28
用上这个 Agent 后,再也不用熬夜做报表了
2025-08-25
企业级ChatBI落地指南:从技术选型到规模化应用的“三步走”策略
2025-08-24
Excel 迎来“AI函数”:COPILOT 正式上线,公式也能开挂了
2025-08-23
AI排名优化:智能时代企业不可不知的流量重构法则
2025-08-23
AI Excel 数据分析智能体
2025-08-22
准确率是ChatBI的生命线:技术架构、提升路径与主流产品深度解析
2025-08-19
Excel 革命:微软宣布 AI 原生接入,不再用插件
2025-07-01
2025-06-08
2025-08-19
2025-06-17
2025-07-18
2025-07-14
2025-06-07
2025-06-16
2025-08-24
2025-07-28
2025-08-16
2025-08-14
2025-08-06
2025-07-29
2025-05-27
2025-05-27
2025-05-12
2025-05-09