一键导入
sql-analysis
Master SQL for data analysis with complex queries, joins, aggregations, window functions, and query optimization.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Master SQL for data analysis with complex queries, joins, aggregations, window functions, and query optimization.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Master business documentation including BRD, FRD, specifications, and technical documentation for clear communication and requirements management.
Master process modeling with BPMN, flowcharts, swimlane diagrams, and process optimization techniques for business process improvement.
Master requirements gathering techniques including interviews, workshops, observation, and documentation for effective requirement elicitation.
Master use case development with actors, scenarios, preconditions, postconditions, and detailed specifications for comprehensive requirements.
Master data visualization with chart selection, dashboard design, Tableau, Power BI, and effective data storytelling.
Master Excel for data analysis with pivot tables, formulas, Power Query, and advanced Excel techniques.
| name | sql-analysis |
| description | Master SQL for data analysis with complex queries, joins, aggregations, window functions, and query optimization. |
Master SQL for extracting, transforming, and analyzing data using complex queries, joins, aggregations, and advanced SQL techniques.
-- Customer purchase analysis with multiple joins
SELECT
c.customer_id,
c.name,
COUNT(DISTINCT o.order_id) as total_orders,
SUM(oi.quantity * oi.price) as total_revenue,
AVG(o.order_total) as avg_order_value
FROM customers c
LEFT JOIN orders o ON c.customer_id = o.customer_id
LEFT JOIN order_items oi ON o.order_id = oi.order_id
WHERE o.order_date >= '2024-01-01'
GROUP BY c.customer_id, c.name
HAVING COUNT(DISTINCT o.order_id) >= 3
ORDER BY total_revenue DESC;
-- Monthly revenue with running total and growth
SELECT
DATE_TRUNC('month', order_date) as month,
SUM(order_total) as monthly_revenue,
SUM(SUM(order_total)) OVER (
ORDER BY DATE_TRUNC('month', order_date)
) as running_total,
LAG(SUM(order_total)) OVER (
ORDER BY DATE_TRUNC('month', order_date)
) as prev_month_revenue,
ROUND(
(SUM(order_total) - LAG(SUM(order_total)) OVER (ORDER BY DATE_TRUNC('month', order_date)))
/ LAG(SUM(order_total)) OVER (ORDER BY DATE_TRUNC('month', order_date)) * 100,
2
) as growth_pct
FROM orders
GROUP BY DATE_TRUNC('month', order_date)
ORDER BY month;
-- Customer cohort retention analysis
WITH first_purchase AS (
SELECT
customer_id,
MIN(order_date) as cohort_month
FROM orders
GROUP BY customer_id
),
monthly_activity AS (
SELECT
fp.customer_id,
fp.cohort_month,
DATE_TRUNC('month', o.order_date) as activity_month,
EXTRACT(MONTH FROM AGE(o.order_date, fp.cohort_month)) as months_since_first
FROM first_purchase fp
JOIN orders o ON fp.customer_id = o.customer_id
)
SELECT
cohort_month,
months_since_first,
COUNT(DISTINCT customer_id) as active_customers
FROM monthly_activity
GROUP BY cohort_month, months_since_first
ORDER BY cohort_month, months_since_first;