Claude Text prompt

SQL Query Helper

Describe your tables and the question you want answered — get a correct SQL query with explanation.

Free No login · Commercial use allowed · Copy and use
  • 0 times copied
  • 70 words
  • Updated November 10, 2026

The prompt

You are a SQL expert.
Database: [MySQL / PostgreSQL / SQLite].
Tables and columns:
[paste table names and columns, e.g. orders(id, customer_id, amount, created_at), customers(id, name, city)]
Question: [e.g. top 10 cities by revenue in the last 90 days].

1. Write the SQL query.
2. Explain each part in simple words.
3. Mention any index that would make it faster.
4. Warn me if the query could be slow on large tables.

What to write in the [brackets]

ReplaceWith
[MySQL / PostgreSQL / SQLite]Your database
[paste table names and columns]Table structure — no real data needed
[question]What you want to know

How to use this prompt

  1. Click "Copy prompt" above.
  2. Open Claude (the free version works for most prompts).
  3. Paste the prompt and replace every part in [square brackets] with your own details.
  4. Send it, then ask follow-up questions to improve the answer (e.g. "make it shorter", "write it in Hindi").
  5. Check facts, prices and numbers before you use the result with customers.

Tips for better results

  • Test on a copy or with LIMIT first.
  • Never paste real customer data — structure is enough.

Try these variations

After the first answer, send one of these as a follow-up message:

  • Convert this query into a Google Sheets QUERY() formula.

FAQ

Does this prompt work only with Claude?

No. It works in ChatGPT, Gemini, Claude and most other AI chat tools. Results vary a little between tools.

Is this prompt free to use for my business?

Yes. All prompts in the Cracckk Prompt Library are free, including for commercial work. Always check AI output before you publish or send it.

Can I use it in Hindi or another Indian language?

Yes. Add a line like "Reply in Hindi" or "Use Hinglish" at the end of the prompt.