跳到正文
cccskills
免费在 GitHub 公开

sales_analytics

Use defined customer and order tables to build sales analysis queries with consistent business rules. Calculate revenue from completed orders, rank customers by spending, and identify high-value orders using the supplied thresholds and SQL example.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

Database schema and business logic for sales data analysis including customers, orders, and revenue.

查看安装方法

适用场景

  • Ranking the top ten customers by revenue over three months
  • Calculating revenue from completed orders
  • Finding orders with a total amount above 1,000
  • Extracting active customers registered at least 90 days ago

包含的文件(1)

  • SKILL.md1.3 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Sales Analytics Schema

Tables

customers

  • customer_id (PRIMARY KEY)
  • name
  • email
  • signup_date
  • status (active/inactive)
  • customer_tier (bronze/silver/gold/platinum)

orders

  • order_id (PRIMARY KEY)
  • customer_id (FOREIGN KEY -> customers)
  • order_date
  • status (pending/completed/cancelled/refunded)
  • total_amount
  • sales_region (north/south/east/west)

order_items

  • item_id (PRIMARY KEY)
  • order_id (FOREIGN KEY -> orders)
  • product_id
  • quantity
  • unit_price
  • discount_percent

Business Logic

Active customers: status = 'active' AND signup_date <= CURRENT_DATE - INTERVAL '90 days'

Revenue calculation: Only count orders with status = 'completed'. Use total_amount from orders table.

High-value orders: Orders with total_amount > 1000

Example Query

-- Get top 10 customers by revenue in the last quarter
SELECT c.customer_id, c.name, c.customer_tier, SUM(o.total_amount) as total_revenue
FROM customers c
JOIN orders o ON c.customer_id = o.customer_id
WHERE o.status = 'completed' AND o.order_date >= CURRENT_DATE - INTERVAL '3 months'
GROUP BY c.customer_id, c.name, c.customer_tier
ORDER BY total_revenue DESC LIMIT 10;

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Use a defined database structure and business rules to query products, warehouses, stock levels, and stock movements. It supports inventory checks and SQL for identifying products whose combined warehouse stock has reached the reorder threshold.

中文简介正在准备中。当前显示英语简介。

  • Checking stock quantities by product and warehouse
  • Finding products at or below their reorder threshold
  • Understanding records for stock movements
alibaba/spring-ai-alibaba1.1万2026年10月7日 更新

查看 alibaba 的全部技能

报告此技能的问题