AI Prompts for Data Analysts: SQL, Visualization, Insights, Reporting
Data analysts sit between raw data and business decisions — you write the queries, build the dashboards, find the patterns, and translate numbers into recommendations. AI can accelerate every part of this workflow, from SQL generation to insight communication. But you need prompts that understand data types, statistical methods, and business context.
Want 190,000+ professional AI prompts?
Get Skillent Pro — $9/monthSQL & Query Building
1. SQL Query Generator
Role: Senior SQL developer
Task: Write a SQL query to [describe what you need to find/calculate].
Database: [PostgreSQL / MySQL / BigQuery / Snowflake / SQL Server]
Schema: [Paste table names, column names, relationships, or describe them]
Requirements:
1. Return columns: [list what you need]
2. Filter conditions: [what rows to include/exclude]
3. Aggregation: [if needed — what to group by, what to aggregate, which function]
4. Join strategy: [which tables, join type, join conditions]
5. Sorting: [order by what, ascending/descending]
6. Limit: [how many rows]
7. Time window: [if applicable — last 30 days, year-to-date, etc.]
Constraints:
- Optimize for performance (avoid subqueries if possible, use CTEs for readability)
- Handle NULLs explicitly
- Use window functions if more efficient
- Add comments explaining complex logic
Output: Ready-to-run SQL query with comments.
Include: Expected output schema (column names and types).
Alternative: Provide a second approach if the first might be slow on large datasets.
2. SQL Query Optimizer
Role: Database performance optimization specialist
Task: Optimize this SQL query for performance.
Query: [Paste the slow query]
Database: [PostgreSQL / MySQL / etc.]
Table sizes: [approximate row counts for each table involved]
Current performance: [execution time]
Indexes: [What indexes currently exist on the tables?]
Analysis:
1. What is the query doing? (explain the intent)
2. Where is the bottleneck? (full table scan, missing index, bad join order, etc.)
3. Optimization recommendations:
a. Index additions (which columns, what type)
b. Query rewrites (CTE, window function, lateral join, materialized view)
c. Schema changes (if applicable — partitioning, denormalization)
4. Expected improvement (estimated execution time after optimization)
5. Trade-offs (does the optimization have any cost? maintenance, storage, complexity?)
Output: Optimized query + optimization plan with before/after comparison.
Include: Execution plan analysis (what the optimizer is doing wrong and why).
3. Data Validation Query Set
Role: Data quality analyst
Task: Write a set of SQL data validation queries for [table/dataset].
Schema: [Table name, columns, types, constraints]
Validation queries needed:
1. Row count (total, by day, by category — check for anomalies)
2. NULL check (which columns have NULLs, what %)
3. Duplicate check (by primary key, by business key)
4. Range check (numeric columns — min, max, outliers)
5. Referential integrity (foreign key violations)
6. Format check (date formats, email format, phone format)
7. Uniqueness check (columns that should be unique)
8. Cross-table consistency (e.g., order total matches line item sum)
9. Data drift (today vs last week, any significant changes?)
10. Schema validation (column types, constraints met?)
For each check:
1. Query
2. What it validates
3. Pass criteria
4. What to do if it fails
Format: Data validation suite ready for scheduled execution.
Analysis & Insights
4. Exploratory Data Analysis Plan
Role: Data science analyst
Task: Create an EDA plan for [dataset description].
Dataset: [What it contains, how many rows, what columns, time range]
Business question: [What are we trying to understand?]
EDA steps:
1. Data overview (shape, types, memory, sample rows)
2. Missing data analysis (which columns, how much, pattern?)
3. Univariate analysis (distribution of each key variable, outliers)
4. Bivariate analysis (relationships between key variables, correlation)
5. Segment analysis (by category, by time, by cohort)
6. Trend analysis (time series decomposition, seasonality, anomalies)
7. Funnel/conversion analysis (if applicable)
8. Cohort analysis (retention, behavior over time)
9. Statistical tests needed (which hypotheses to test, which test)
10. Visualization plan (what charts tell the story best)
For each step:
1. What to calculate
2. What to look for (what constitutes interesting vs expected)
3. What chart to create
4. What business question it answers
Format: EDA checklist ready for execution in Python/R.
5. Anomaly Detection Framework
Role: Data analyst specializing in anomaly detection
Task: Create an anomaly detection framework for [metric/dataset].
Metric: [What we are monitoring — revenue, traffic, error rate, etc.]
Historical data: [Time range, typical values, known seasonality]
Methods to consider:
1. Statistical (z-score, IQR, modified z-score)
2. Time series (ARIMA residuals, Prophet, exponential smoothing)
3. Machine learning (isolation forest, one-class SVM, autoencoder)
4. Business rules (thresholds, rate of change, domain knowledge)
For each method:
1. How it works (1-2 sentences)
2. When it works best
3. Limitations
4. Parameters to tune
5. How to interpret results
Output:
1. Recommended approach (with rationale)
2. Implementation plan (Python code structure, libraries needed)
3. Alert thresholds (what triggers investigation)
4. False positive mitigation (how to reduce noise)
5. Feedback loop (how to improve detection over time)
Format: Anomaly detection strategy document.
6. Cohort Analysis Template
Role: Product data analyst
Task: Design a cohort analysis for [product/metric].
Cohort definition: [How to group users — signup month, first purchase, plan type]
Metric to track: [Retention, revenue, engagement, churn]
Time granularity: [Daily / weekly / monthly]
Data available: [User events table, subscription table, etc.]
Output:
1. SQL query to build the cohort table (users x time periods)
2. Cohort retention matrix (text representation)
3. Visualization recommendation (heatmap, line chart, or both)
4. Key metrics to calculate:
- Cohort size
- Retention rate per period
- Cumulative retention
- Revenue per cohort
- Churn rate per cohort
5. Analysis questions to answer:
- Are newer cohorts retaining better or worse?
- Is there a specific period where dropoff is highest?
- Do different acquisition channels produce different retention curves?
Format: Cohort analysis guide with SQL, visualization plan, and interpretation framework.
Visualization & Reporting
7. Dashboard Design Brief
Role: Data visualization designer
Task: Design a dashboard for [audience and purpose].
Audience: [Executive / department head / analyst / operational team]
Purpose: [What decisions will this dashboard inform?]
Metrics available: [List data sources and metrics]
Design elements:
1. Layout (top: KPIs, middle: trends, bottom: detail table)
2. Chart types per metric (trend = line, comparison = bar, composition = stacked, distribution = histogram, correlation = scatter)
3. Filters needed (date range, segment, geography, product)
4. Color scheme (accessibility, brand alignment, semantic — red/green for bad/good)
5. Interaction (drill-down, cross-filter, tooltip details)
6. Refresh frequency (real-time, hourly, daily)
7. Alert thresholds (when to notify, who)
8. Mobile considerations (will this be viewed on phone?)
For each chart:
1. Chart type
2. Data source (query/table)
3. Dimensions and measures
4. Filters
5. Why this chart (what insight does it surface?)
Format: Dashboard specification ready for implementation in [Tableau/Looker/PowerBI].
8. Executive Summary from Data
Role: Data storytelling specialist
Task: Write an executive summary from this data analysis.
Analysis: [Paste key findings, metrics, comparisons, trends]
Audience: [C-suite / VP / department head — what do they care about?]
Format:
1. Headline (1 sentence: the most important takeaway)
2. Key Metrics (3-5 numbers with context — vs last period, vs target)
3. What Changed (2-3 bullet points on significant shifts)
4. Why It Matters (business impact — revenue, risk, opportunity)
5. Recommendation (1-2 specific actions based on the data)
6. Appendix reference (where to find the full analysis)
Constraint:
- No jargon. No methodology. Just findings and action.
- Every number needs context (vs what? compared to what?)
- Keep under 200 words.
- If the recommendation costs money, note the ROI.
Format: Email-ready executive summary.
9. A/B Test Analysis Report
Role: Experimentation analyst
Task: Analyze and report on this A/B test.
Test description: [What was tested, hypothesis, variants]
Data: [Sample sizes, conversion rates, metrics, time period]
Analysis:
1. Statistical significance (p-value, confidence level, which test was used)
2. Effect size (absolute difference, relative difference %, confidence interval)
3. Power analysis (was the sample size adequate? post-hoc power)
4. Segment analysis (did the effect vary by segment? — interaction effects)
5. Practical significance (does the effect matter for the business?)
6. Side effects (did any guardrail metrics get worse?)
7. External validity (can we generalize? any confounders?)
Output:
1. Verdict (Ship / Do not ship / Collect more data — with rationale)
2. Confidence level (how sure are we?)
3. Estimated impact (annualized, if shipped)
4. Risks (what could go wrong if we ship)
5. Next steps (further experiments, rollout plan)
Format: A/B test report for product/stakeholder review.
Data Engineering & Automation
10. Data Pipeline Design
Role: Data pipeline architect
Task: Design a data pipeline for [data source to destination].
Source: [API, database, CSV, log files, etc. — volume, frequency, format]
Destination: [Data warehouse, data lake, database, etc.]
Requirements:
1. Extraction (full load vs incremental, CDC, batch vs streaming)
2. Transformation (cleaning, enrichment, aggregation, joins)
3. Loading (append, upsert, replace, schema evolution)
4. Scheduling (frequency, dependencies, SLA)
5. Error handling (retry, dead letter queue, alerting)
6. Data quality checks (at ingestion and after transformation)
7. Monitoring (latency, throughput, failure rate, data volume)
8. Cost optimization (right-size compute, optimize queries, lifecycle management)
Output:
1. Pipeline architecture description (stages, tools, data flow)
2. Technology recommendation (with rationale)
3. Schema mapping (source fields -> destination fields, transformations)
4. Error and alerting design
5. Implementation roadmap (MVP then enhancements)
Format: Pipeline design document for data engineering team.
11. Python Data Analysis Script
Role: Python data analyst
Task: Write a Python script to analyze [dataset/business question].
Data source: [CSV path / SQL query / API endpoint / dataframe]
Libraries available: [pandas, numpy, matplotlib, seaborn, plotly]
Analysis steps:
1. Load data (with error handling, dtype specification)
2. Clean data (handle missing, duplicates, type conversions, outliers)
3. Feature engineering (derived columns, aggregations, bins)
4. Analysis (describe what analysis to perform — groupby, correlation, time series)
5. Visualization (which charts, formatting, labels, colors)
6. Export results (CSV, Excel, PNG, JSON)
Requirements:
- Modular functions (not one long script)
- Config section at top (file paths, parameters, thresholds)
- Logging (info, warnings, errors)
- Docstrings for each function
- Handle edge cases (empty data, all-NULL columns, single-row)
Output: Production-ready Python script with example usage in __main__.
12. Metric Definition Document
Role: Analytics product manager
Task: Create a metric definition document for [metric name].
Metric: [e.g., Monthly Active Users, Customer Lifetime Value, Net Revenue Retention]
For this metric:
1. Definition (plain English — what does it measure?)
2. Formula (exact calculation — with parentheses for order of operations)
3. Inputs (which tables, which columns, which filters)
4. Time period (point-in-time, rolling, cumulative)
5. Segments (how is it sliced? geography, plan, channel, cohort)
6. Edge cases (how are these handled?):
- Missing data
- Deleted users/accounts
- Timezone handling (UTC vs local)
- Duplicate events
- Attribution window
7. Known limitations (what does this metric NOT capture?)
8. Related metrics (companion metrics, denominators, benchmarks)
9. Ownership (who defines, who calculates, who communicates)
10. Review cadence (how often do we verify the definition is still correct?)
Format: Metric definition document for the analytics glossary / data catalog.
190,000+ professional AI prompts for every industry.
Get Skillent Pro — $9/monthBest Practices
For more analytics content, see our AI prompts for data analysis and ChatGPT prompts for report writing.
Disclaimer: These prompts are tools for data analysts, not substitutes for professional judgment. AI-generated SQL and analysis must be reviewed by a qualified analyst. Skillent and Valles Global, LLC are not responsible for decisions made based on AI-generated content.
Ready to level up your work with AI?
Get Skillent Pro — $9/month