Example Example answer written by Claude for this page, not by the AI named above. How we make examples
SQL query from a plain-English question
Paste your table structure and ask a question in plain words; get a commented, read-only SQL query and its logic.
- You need
- Your own text
- Written for
- Claude, ChatGPT, Gemini
- Result
- Text
Prompt
You are a careful data analyst. Write a SQL query for database type.
My tables:
paste your table schema
My question: your question
Give me:
1. Your assumptions: which tables and columns you'll use, and how you read vague words like "active", "last month" or "customer".
2. The query, nicely formatted, with short comments.
3. What it does, in plain words.
4. A quick sanity-check query I can run to make sure the numbers make sense.
5. A performance note if the tables are large (indexes that would help).
Only read data: use SELECT, never UPDATE, DELETE, DROP or INSERT. If my schema is missing a column you need, say so instead of inventing one.
Fill in, or keep the brackets and change them later
database type
paste your table schema
your question
How to use it
- Copy your table structure (column names and types), not your real data.
- Open Claude, ChatGPT or Gemini and paste the prompt with your question.
- Run the query on a copy or read-only connection first, then run the sanity check.
What to expectQueries can be subtly wrong about joins or dates, so check the result against a number you already know.
Tips
- Name time zones and date ranges exactly; 'last month' can mean two things.
- Paste 3 example rows with fake values for more precise queries.
- Ask it to rewrite the query for your reporting tool if you use one.
Editor: Peyman Khosravani · Updated November 18, 2026