Data Analysis · Legal

Write SQL to answer a business question for Legal

Use this when you need data from a database but writing the query is slow or tricky. Written for a mid-sized law firm.

Your prompt is ready 3 brackets to fill
You are a SQL expert, working with clients, partners and associates at a mid-sized law firm.

## Goal
Write correct, efficient SQL that answers a business question.

## What matters in Legal
- Numbers that matter: matter turnaround; billable utilisation; realisation rate; client retention; win or settlement rate.
- Tools commonly used: document and case management; research databases (Westlaw, SCC Online, Manupatra); Word with tracked changes.
- Rules and standards that usually apply: client confidentiality and privilege; bar council and professional-conduct rules; the law of the relevant jurisdiction; limitation periods and court deadlines; conflict checks; every output is a draft for a qualified lawyer, not legal advice.
- Rules differ by country. If I have not said where I work, ask me, and do not present one country's law as if it applied everywhere.

## What I will give you
- Database: [MySQL, PostgreSQL, SQL Server, BigQuery]
- Tables and columns: [PASTE SCHEMA]
- Question: [WHAT YOU NEED]

## What to do
1. Restate the question as precise logic.
2. Write the query with clear aliases and comments.
3. Explain each part of the query.
4. Point out edge cases (nulls, duplicates, time zones).
5. Suggest indexes if it will run often.

## What to deliver
- The SQL query
- Line-by-line explanation
- Edge case notes
- Index suggestions

## Rules
- Keep client confidentiality, professional-conduct rules and jurisdiction (the output is a draft for a qualified lawyer to review, not legal advice) in mind throughout, and point out anything in my plan that would break them.
- Where it fits, connect your recommendations to matter turnaround and billable utilisation.
- Use plain language and short sentences. Use headings and tables where they make the answer easier to scan.
- Do not invent figures, laws, sources or quotes. Mark anything you had to assume with "Assumption:".
- If something important is missing, ask me up to 3 short questions before you start.

## Before you answer
Check your draft against this list and fix anything that fails:
- Every number comes from my data or is marked as an assumption, and correlation is never presented as cause.
- It is written for a mid-sized law firm; nothing in it would read the same for any other business.
- Every item under "What to deliver" is included.
Open in ChatGPT Claude Perplexity

How to use this prompt

  1. Copy the prompt. Press Copy prompt and the full text goes to your clipboard.
  2. Fill the brackets. Use the form above, or replace [MySQL, PostgreSQL, SQL Server, BigQuery], [PASTE SCHEMA], [WHAT YOU NEED] with your own details.
  3. Paste and send. Paste it into ChatGPT, Claude, Microsoft Copilot and DeepSeek and send. Ask follow-up questions to refine the answer.

Why use this Write SQL to answer a business question prompt?

This write sql to answer a business question prompt is written for a mid-sized law firm. It tells the assistant who the answer is for (clients, partners and associates) and the limits it must respect: client confidentiality, professional-conduct rules and jurisdiction (the output is a draft for a qualified lawyer to review, not legal advice). That context is what turns a generic reply into one a Legal team can use straight away.

Most people type a single line and get a generic answer back. This prompt gives the assistant the role, the context and the structure it needs, so the first answer is already close to what you would hand to your team. Because it is written for Legal, it keeps the focus on what that industry measures: matter turnaround and billable utilisation.

How to get the best answer

  1. Be specific in the brackets: real names, numbers and dates give a far better answer than placeholders.
  2. Paste real material: where the prompt asks for notes, data or text, paste the actual content rather than a summary.
  3. Refine in the same chat: ask "make it shorter", "turn it into a table" or "add more detail on step 2".
  4. Check the result: review it against what you know about matter turnaround and billable utilisation before you share it.

Other industries

Same prompt for other industries

The same write sql to answer a business question prompt, rewritten for each industry.

FAQ

Frequently asked questions

Which AI assistant works best with this Write SQL to answer a business question prompt?

It works in any chat assistant. It suits ChatGPT, Claude, Microsoft Copilot and DeepSeek best. Paste it in, send it, and ask follow-up questions in the same chat.

What do I need to replace before sending it?

Replace the 3 highlighted brackets – [MySQL, PostgreSQL, SQL Server, BigQuery], [PASTE SCHEMA], [WHAT YOU NEED] – with your own details. The more specific you are, the better the answer.

Is this prompt only for Legal?

This version is written for a mid-sized law firm. The same prompt is also available for 15 other industries, listed on this page.

Is it free to use?

Yes. Copy it as often as you like and use it in your own work. No sign-up is needed.

Can I trust the answer?

Treat it as a strong first draft. Check facts and figures yourself, especially anything with legal, financial, medical or safety consequences.

Keep exploring

Browse more Legal prompts