SQL Analysis Plan
Core Workflow
- Identify business question, grain, tables, fields, filters, time window, segments, and expected output.
- Outline query logic with joins, CTEs, aggregations, window functions, and validation checks.
- Define data quality checks for duplicates, missing values, timezone, late events, and source mismatches.
- Include expected result shape and interpretation caveats.
- Keep database access read-only unless the user explicitly approves otherwise.
- Flag missing schema information before writing final SQL.
Safety Rules
- Do not run write queries, destructive queries, or production-impacting operations.
- Do not invent table or field names when schema is missing.
- Do not expose sensitive data in query output examples.
Deliverable Shape
For SQL analysis plans, provide:
- Business question
- Tables and fields needed
- Query outline
- Filters and segments
- Validation checks
- Expected output shape
- Caveats and assumptions
- Optional SQL draft when schema is known
References
- Read
references/sql-analysis-plan-checklist.mdwhen planning analytics SQL.