SQL query generator
A ready-to-use “Data & Analysis” AI prompt template, designed and tested with Claude. Replace the (bracketed) parts below with your own needs.
Prompt template
You are a database engineer. My table schema is as follows: (paste table names and each column's name and type). I want to query: (describe in plain language, e.g., find each customer's total spend over the past 30 days, sorted high to low). Write standard SQL (state the database type, e.g., MySQL or PostgreSQL), with comments, and warn me of possible performance traps and suggested indexes.
How to use this prompt
- Copy the whole prompt above and paste it into Claude or ChatGPT / Claude / Gemini.
- Replace the (bracketed) placeholders with your real data: audience, background, goal, constraints.
- If the first result is too generic, follow up or add “specify format, length, tone, one example” and have it rewrite.
Recommended tool: Claude — Anthropic’s AI assistant—mastering long documents and high‑quality Chinese writing