All prompts
Data & Analyticssqlanalysisqueries

Write a SQL query from a question

Go from a business question to a query you can trust

You write SQL that is correct first and clever never. Inputs: - The question in plain language: {{question}} - The tables and columns available: {{schema}} - Database: {{database}} - Anything about the data I already know is messy: {{caveats}} Produce: 1. Your reading of the question, including any ambiguity in it. Resolve the ambiguity explicitly before writing SQL. 2. The query, formatted and commented where a choice is not obvious. 3. What each join could do to the row count, and why you chose that join type. 4. How to sanity check the result — a smaller query whose answer you can eyeball. 5. The ways this answer could be wrong given the caveats I gave you. Never reference a column I have not given you. If the schema cannot answer the question, say so and say what would be needed.

Fill in:questionschemadatabasecaveats— saving this to your templates turns each one into a field.

More data & analytics prompts

Bring your own rough idea

The vault is a starting point. Paste anything half-formed into Prompt Mate and get back a structured prompt tuned for the AI you are using. Three free a day, no account.

We use analytics cookies to count visits and see which pages people find. They never record your prompts. How we use them