Skip to content
New this week26 prompts for Sora, Veo and Runway video workflows.
Explore video prompts→
AIPrompt123Prompt library

Search AIPrompt123

Search prompts, categories, platforms and repositories

Data AnalysisIntermediateEditor's pick

Turn a business question into SQL

This copy-ready data analysis prompt helps you turn a business question into SQL with fewer blank-page decisions. Paste it into ChatGPT and Claude, fill the variables, and you get a structured first draft you can edit. It is written for repeatable results and tells you what to check before publishing.

4.7(26 ratings)1.7k copies
Updated By Site Admin
42 words · v1.2

Fill in the blanks · 2 variables

ChatGPT promptReplace every highlighted token before sending
Translate this business question into a PostgreSQL query: {question}. Use the schema below. Explain the grain, joins and filters first, then the query, then a verification query that checks the total. Flag any ambiguity in the question instead of guessing.

Schema:
{schema}

---
Platform note: Work through the task step by step, then give the final answer in the requested format. Ask one clarifying question if a required detail is missing.
Open in ChatGPT

Comments

Share what worked, what broke and which model you used. Comments appear after posting and are moderated for spam.

Saved with an anonymous browser ID. No login needed.

How to use this prompt

  1. 1

    Open ChatGPT and start a new chat. Paste the prompt exactly as written.

  2. 2

    Replace each placeholder ({question}, {schema}) with your own details. Leave the instructions and the output format untouched.

  3. 3

    Add one concrete example or data point if the model's first answer is vague. Specific input produces specific output.

  4. 4

    Run it once, then ask for a single revision with a specific critique rather than regenerating from scratch.

  5. 5

    Review the result. Reconcile totals to a trusted source, verify the query and review the statistical claim with an analyst.

Worked example

This is the kind of input the prompt expects and the shape of output it produces. Your result will differ with the model and the details you supply.

Example input

Question: Which plan has the highest 90-day retention? Schema: users(id, created_at, plan); events(user_id, name, created_at)

Example output

**Finding:** activation within 7 days predicts 90-day retention, but the effect is concentrated in self-serve signups. **Method:** cohort by signup month, activation defined as completing two core actions within 7 days, retention measured on day 90. Excludes internal accounts and trials. **Caveat:** sales-assisted accounts are small and may be underpowered. This is correlational, not causal. **Sanity check:** total users reconcile to the billing table within 0.4%.

Tips for a better result

  • Give the schema and the metric definition before asking for an interpretation.
  • Ask for the query or code so you can rerun it and check a known total.
  • Require a 'what this cannot tell us' section to surface confounders.
  • Change one variable at a time and compare the outputs; it is the fastest way to learn what this model responds to.

Common mistakes

  • Trusting a percentage without checking the denominator or sample size.
  • Treating correlation as causation in a retention or revenue analysis.
  • Letting the model invent a result for data it was not given.
Verified Knowledge · FAQ

Questions about this prompt

Practical answers about running the turn a business question into sql prompt.

Related prompts

Same job, a different angle — or the next step in the workflow.

Interpret an A/B test result

A data analysis prompt for interpret an A/B test result. It gives Claude and ChatGPT a clear role, explicit constraints and a defined output, so the first answer is closer to usable. Fill in the variables, run it once, then use the verification notes on this page to review the result.

ClaudeChatGPT
4.9(55)1.4k copies
Data Analysis
Intermediate

Check a metric definition for ambiguity

Check a metric definition for ambiguity with a prompt built for Claude and ChatGPT. It supplies context, constraints and an output contract, then asks the model to surface assumptions and gaps. Copy it, fill the variables and treat the result as a structured draft, not a final answer.

ClaudeChatGPT
4.8(78)1.1k copies

Write a data dictionary

A data analysis prompt for write a data dictionary. It gives ChatGPT and Claude a clear role, explicit constraints and a defined output, so the first answer is closer to usable. Fill in the variables, run it once, then use the verification notes on this page to review the result.

ChatGPTClaude
4.7(62)992 copies

Written and reviewed by Site Admin

Author & Platform Administrator

Administrator and lead editor at AIPrompt123, curating high-performance AI prompts, SEO/AEO/GEO strategies, and developer repositories.

Last reviewed 2 May 2026 · version 1.2 · tested on ChatGPT, Claude, DeepSeek