Turn a Question Into a SQL Query
Describe your tables and ask in plain English; get a correct, dialect-aware SQL query with a short explanation.
0 likes
0 dislikes
Sign in to rate this prompt
Prompt
Write a SQL query that answers the question below.
Question (in plain English):
{{question}}
Database dialect (e.g. PostgreSQL, MySQL, SQLite, BigQuery): {{dialect}}
Schema — paste the relevant CREATE TABLE statements, or describe the tables and columns:
{{schema}}
Please:
1. Return the query, formatted and readable, using only tables and columns that exist in the schema above.
2. Explain in a sentence or two what it does and any assumption you made (for example, how you interpreted "active" or "last month").
3. If the schema doesn't contain what's needed to answer the question, say what's missing instead of inventing columns.
Prefer clarity over cleverness. Note if there's an index or a rewrite that would matter for performance on a large table.
Why this prompt works
-
How to Deploy an AI Agent
Every deployment problem follows from one property: you don't know how long a run takes, because you didn't write the path. Why the run m...
Read the guide → -
MCP Authorization and OAuth
Optional until you opt in, then very specific. Why the resource parameter is mandatory even when the server ignores it, why PKCE doesn't ...
Read the guide → -
MCP Transports: stdio vs Streamable HTTP
There are two transports now, not three, and the one that vanished is the one most tutorials still document. What each is exposed to, why...
Read the guide →