npx skills add https://github.com/danhvb/my-ba-skills --skill 'SQL Analysis'使业务分析师能够验证数据需求、理解当前数据状态,并在不单纯依赖开发人员的情况下进行独立的数据分析。
SELECT column1, column2 -- 你想要什么?
FROM table_name -- 从哪里获取?
WHERE condition -- 过滤逻辑
ORDER BY column1 DESC; -- 排序
WHERE status = 'Active' (精确匹配)WHERE quantity > 10 (比较)WHERE name LIKE 'Smith%' (部分匹配)WHERE status IN ('New', 'Open') (列表匹配)WHERE end_date IS NULL (查找缺失数据)汇总数据。
SELECT status, COUNT(*) as total_orders
FROM orders
GROUP BY status;
连接相关数据。
"是否存在重复的客户邮箱?"
SELECT email, COUNT(*)
FROM customers
GROUP BY email
HAVING COUNT(*) > 1;
"是否存在没有有效用户的订单?"
SELECT o.order_id
FROM orders o
LEFT JOIN users u ON o.user_id = u.id
WHERE u.id IS NULL;
"订单发货需要多长时间?"
SELECT
AVG(DATEDIFF(day, order_date, shipped_date)) as avg_days_to_ship,
MAX(DATEDIFF(day, order_date, shipped_date)) as max_days
FROM orders
WHERE shipped_date IS NOT NULL;
"'支付方式'有哪些不同的值,以便我们进行映射?"
SELECT DISTINCT payment_method
FROM transactions;
LIMIT 10(或 TOP 10)。COUNT(column) 忽略 NULL 值;COUNT(*) 计算所有行。每周安装数
0
仓库
首次出现
1970年1月1日
安全审计
Enable BAs to validate data requirements, understand current data states, and perform independent data analysis without relying solely on developers.
SELECT column1, column2 -- What do you want?
FROM table_name -- From where?
WHERE condition -- Filter logic
ORDER BY column1 DESC; -- Sorting
WHERE status = 'Active' (Exact match)WHERE quantity > 10 (Comparison)WHERE name LIKE 'Smith%' (Partial match)WHERE status IN ('New', 'Open') (List)广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
WHERE end_date IS NULL (Finding missing data)Summarizing data.
SELECT status, COUNT(*) as total_orders
FROM orders
GROUP BY status;
Connecting related data.
"Are there any duplicate customers by email?"
SELECT email, COUNT(*)
FROM customers
GROUP BY email
HAVING COUNT(*) > 1;
"Are there orders without a valid user?"
SELECT o.order_id
FROM orders o
LEFT JOIN users u ON o.user_id = u.id
WHERE u.id IS NULL;
"How long does it take to ship an order?"
SELECT
AVG(DATEDIFF(day, order_date, shipped_date)) as avg_days_to_ship,
MAX(DATEDIFF(day, order_date, shipped_date)) as max_days
FROM orders
WHERE shipped_date IS NOT NULL;
"What are the distinct values for 'Payment Method' so we can map them?"
SELECT DISTINCT payment_method
FROM transactions;
LIMIT 10 (or TOP 10) when exploring new tables.COUNT(column) ignores NULLs; COUNT(*) counts everything.Weekly Installs
0
Repository
First Seen
Jan 1, 1970
Security Audits
Excel财务建模规范与xlsx文件处理指南:专业格式、零错误公式与数据分析
42,000 周安装