Tau
AI prompt · about 60 seconds

Turn a plain-English question into SQL

A working query with an explanation, so you can check it, not just run it.

What most people type

write sql for sales by region

Short prompts like this get generic answers, because the AI has to guess who you are and what you need.

A better prompt

Act as a senior data analyst. I'll share column names only, no real data. Tool or SQL dialect: [YOUR DATABASE OR TOOL]. Tables and columns: [THE TABLES AND COLUMNS]. What I want: [YOUR QUESTION]. Give me: 1) the query, formatted and commented, 2) a 3-line plain-English explanation of what it does, 3) assumptions you made (date ranges, nulls, duplicates), 4) one quick sanity check I can run to confirm the numbers are right. If my question is ambiguous, state your interpretation. End by asking me one question that would make this more useful.

Fill in the blanks

Swap each highlighted part for your own details. Here’s an example.

  • [YOUR DATABASE OR TOOL]
    PostgreSQL
  • [THE TABLES AND COLUMNS]
    orders(order_id, order_date, region, amount, status)
  • [YOUR QUESTION]
    monthly revenue by region for the last 6 months, completed orders only

What a good answer looks like

SELECT date_trunc('month', order_date) AS month, region, SUM(amount) AS revenue FROM orders WHERE status = 'completed' -- current month plus the 5 before it AND order_date >= date_trunc('month', CURRENT_DATE) - INTERVAL '5 months' GROUP BY 1, 2 ORDER BY 1, 2; What it does: keeps completed orders from the last 6 calendar months, groups them by month and region, and totals the amount. Assumptions: - The current, partial month counts as one of the 6 - amount is already net of refunds Sanity check: sum revenue for one month without the region split and compare with your dashboard. Question: should the current partial month be excluded?

This is a sample answer for the example above. Yours will be different, so check it against your own facts.

Make it even better

Paste a few rows of fake sample data and the expected result so it can test its own query.

Stay safe

Learn the skill behind it

This prompt comes from the course AI for data analysts. The next lesson to watch is “Write formulas and SQL from plain English”.

Try this in Tau

In Tau, you can fill in the blanks, run the prompt and get feedback, then watch the one-minute lesson that explains why it works. Join the waitlist for early access.