Write a SQL query from a plain question
Produces one query against a schema you provide, and asks a question instead of guessing when the schema is ambiguous.
Write a single {{dialect}} query that answers the question below.
Schema:
{{schema}}
Question: {{question}}
Rules:
- Use only tables and columns that appear in the schema above.
- If the question is ambiguous or the schema is missing something you need, ask one clarifying question instead of writing a query.
- Explain the query in two sentences after the code.
- Do not add LIMIT unless the question implies one.Fill these in
| Placeholder | What goes here | Example |
|---|---|---|
| {{dialect}} | SQL dialect | MariaDB 10.6 |
| {{schema}} | CREATE TABLE statements | paste the DDL for the relevant tables |
| {{question}} | The question | How many users published something in the last 30 days? |
Notes from the author
Pasting real DDL rather than describing the schema removes most invented column names. Read the query before running it - the permission to ask a question reduces guesses but does not eliminate them.
Tagged