Skip to main content
Promptivo logoPromptivo

Copilot prompt to write a SQL query

A copy-paste prompt that produces a correct, readable SQL query from a plain-language description of what you need.

Tuned for Copilot · structured role / context / task / output

Open in the builder →

Ready-to-use prompt

# Role
You are a senior software engineer who writes clear, idiomatic, production-quality code.

# Context
Write a query that returns the top 10 customers by revenue this quarter.


# Task
Write the code described in the context above. Make it correct and idiomatic, handle the obvious edge cases, and briefly note any assumptions inline.

# How to approach this
Think through the problem step by step before answering. Work the hard parts out explicitly, then give a clear final answer. Let the difficulty of the task set how much reasoning is needed — don't pad the easy steps.

# Constraints
- Use clean, professional formatting that pastes cleanly into Word, Outlook, and Excel. Prefer tables and numbered steps for anything structured.
- Deliver one finished, office-ready result rather than a set of options.
- Keep the tone professional and workplace-appropriate unless the prompt says otherwise.
- For spreadsheet or document tasks, give the exact formula, steps, or text — never a vague description of what to do.
- Deliver the result directly — no apologies or meta-commentary about the prompt itself.

# Output format
Return the code in a single fenced code block. Brief inline comments only for non-obvious decisions.

Customize this prompt

Answer a few quick questions and Promptivo re-tunes the prompt above to your exact situation.

Start the interview →

Why this prompt works

SQL is precise, so the prompt forces the schema/table context into the Context block — without it the model invents column names.

Asking for the dialect (Postgres, MySQL, BigQuery) is included because functions and syntax diverge and a generic query often won't run.

Requesting a one-line explanation of the query as output catches logic errors the user can spot before running it.

Using this prompt in Copilot

For a SQL query, Copilot is a strong choice — it's especially good at Office-ready output you can finish in Word, Outlook, and Excel. Promptivo formats this prompt the way Copilot works best: office-ready output that pastes cleanly into Word, Outlook, and Excel, with tables and numbered steps.

Paste it into Microsoft Copilot or the Microsoft 365 side-panel, then replace any bracketed details with your own. Copilot generalizes when it is under-fed, so keep the bracketed context specific and it will stay grounded in your details.

Tuned for Copilot — and how it differs

ModelWhat Promptivo changes
ChatGPTConcise instructions, strict format adherence, no preamble.
ClaudeExplicit step-by-step thinking and clearly delimited output sections.
GeminiPrecise phrasing with brief reasoning cues where they improve accuracy.
CopilotOffice-ready output that pastes cleanly into Word, Outlook, and Excel, with tables and numbered steps.

Questions, answered

What should a SQL prompt always include?
The dialect, the relevant table and column names, and the exact result you want. Promptivo's interview captures these so the query runs the first time.
Is Copilot good for a SQL query?
Yes. Copilot handles a SQL query well thanks to its Office-ready output you can finish in Word, Outlook, and Excel, and Promptivo tunes the prompt to match — office-ready output that pastes cleanly into Word, Outlook, and Excel, with tables and numbered steps. Paste it into Microsoft Copilot or the Microsoft 365 side-panel.

Related prompts