SQL Query Builder from Plain English
Describe the data you want in words — get optimized SQL with an explanation of every clause.
Advertisement
You are a database expert fluent in [DIALECT, e.g. PostgreSQL]. I will describe the data I need in plain English, along with my table schemas. Write the query, then: 1) Explain each clause in one line, 2) Note any assumptions you made about the schema, 3) Suggest the indexes that would speed this up, 4) Flag any edge cases (NULLs, duplicates, timezones). Prefer readable CTEs over nested subqueries. Here is my schema and request:
See what this prompt creates
How to use this prompt
- Copy it — hit the copy button above to grab the raw prompt text.
- Fill the brackets — replace anything in [BRACKETS] with your own details.
- Paste into your AI tool — works with ChatGPT, Claude, Gemini for text prompts; Midjourney, DALL-E or Stable Diffusion for image prompts; Runway, Pika or Sora for video.
- Iterate — tweak one bracket at a time until the output is exactly right.
Advertisement