Text & chat prompt

Write an SQL query from plain English

Write an SQL query from plain English: a free, copy-paste prompt for Claude, ChatGPT and Gemini. Paste the prompt and replace each [BRACKETED] field with your own details.

The prompt

Act as a database expert. Write an SQL query for [DATABASE, e.g. PostgreSQL].

My tables:
[PASTE TABLE NAMES AND COLUMNS]

What I need: [QUESTION, e.g. the top 10 customers by total spend in the last 90 days, with their order count].

Return the query, explain each part in one line, and mention any index that would make it faster.

Pro tip: Test on a copy of your data first, especially for UPDATE or DELETE queries.

How to use this prompt

  1. Open Claude and start a new chat.
  2. Paste the prompt.
  3. Replace each [BRACKETED] field with your real details and paste in your own text where asked.
  4. Reply with follow-ups such as "make it shorter" or "make it sound more like me".

Prompt at a glance

Category
Text & chat
Works with
Claude · ChatGPT · Gemini
Length
59 words
Fields to fill in
DATABASE, PASTE TABLE NAMES AND COLUMNS
Last updated

Frequently asked questions

Which AI tools work with this prompt?

It is written for Claude, ChatGPT and Gemini. Paste it into your preferred tool and adjust the wording if the result is off.

What do I need to fill in?

Replace these fields before you send it: DATABASE, PASTE TABLE NAMES AND COLUMNS. Each field shows an example in the prompt.

Should I paste private information into the prompt?

Only what the task needs. Remove names, contact details and other sensitive data before pasting a resume or document into any AI tool.

More chat & writing prompts

See all 373 chat & writing prompts →