Esc

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.

AI Place Hub 43
PromptCopied
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

Type your values and Copy gives you the finished prompt, not the template.

Nothing filled in yet - Copy will give you the template with placeholders.

Notes from the author

Paste the real DDL and the model stops inventing column names. Read the query before you run it. The permission to ask a question cuts guessing down but never to zero.

For information only, not professional advice. You use it at your own risk and we are not liable for any loss or damage. See the disclaimer.

Fork

Did this work for you?

Sign in to flag it

Tagged

Related

  • ToolUniversalLIBRARYFree, open source

    LlamaIndex

    A Python framework for retrieval only. It connects a model to your own documents, databases or APIs, and does not try to chain everything.

    Tested on Claude Sonnet · Jun 2026

    Coding0050AI Place Hub
  • ToolUniversalLIBRARYFree, open source

    LangChain

    A Python and JavaScript framework for chaining prompts, tools and retrieval into a pipeline, with a large set of ready-made integrations.

    Tested on GPT-5 · Jun 2026

    Coding0047AI Place Hub
  • ToolUniversalLIBRARYFree, open source

    Instructor

    A small Python library that forces a model output into a Pydantic schema and retries automatically when the response fails validation.

    Tested on Claude Sonnet · Jun 2026

    Coding0047AI Place Hub
  • ToolUniversalLIBRARYFree, open source; deepset also offers a paid hosted platform

    Haystack

    An open-source Python framework from deepset for production retrieval and search pipelines, with more explicit pipeline control than most…

    Tested on GPT-5 · Jun 2026

    Coding0046AI Place Hub