Skip to content
Faisal Habib

SQL Query Writer & Explainer

CodingWorks with Any AIPremium · Free

By · Published · Updated

Describe what data you need in plain English and get a working SQL query for MySQL, PostgreSQL, SQLite, SQL Server or BigQuery, explained line by line, with sample output and speed tips.

1. Fill in your details

Every detail is optional. Fill in what you know and leave the rest blank; the more you add, the better your result.

Your database

What kind of SQL

How much to explain

Language for explanations. Code stays in English

0 of 8 details filled

2. Your generated prompt

Nothing here yet

Fill in your details above and click Generate prompt. Your ready-to-use prompt will appear here.

How to use this prompt

  1. Pick your database type and list your tables and columns.
  2. Describe the result you want in plain English.
  3. Click Generate prompt, then Copy prompt or open it in ChatGPT, Claude, Gemini, Copilot, Perplexity, Grok or any AI app.
  4. Run the query on a test copy first, especially for updates or deletes.

SQL tips

  • Run a SELECT with the same WHERE clause before any UPDATE or DELETE to see what will change.
  • Paste CREATE TABLE statements for the most accurate queries.
  • Do not understand an old query? Paste it into the Code Explainer.
  • Working in spreadsheets instead? Try the Excel & Google Sheets Formula Helper.

Example: how to fill it in

Here is how a shop owner might fill in the form.

FieldExample answer
Database typePostgreSQL
Tables and columnscustomers: id, name, email. orders: id, customer_id, total, created_at
What I needTop 10 customers by total spend last month, with their email
Query typeReport with totals
SQL levelBeginner

Common mistakes and how to fix them

  • No table details. List tables and columns, or the AI has to guess names.
  • Deleting without checking. Preview with a SELECT and back up first.
  • Wrong database type. Syntax differs. Pick your exact database.
  • Building SQL from strings. Use parameters in app code to prevent SQL injection.

Follow-up prompts to try

After the first result, keep the same chat open and send one of these:

  • "Add a filter for orders over 100."
  • "Turn this into a monthly report for the whole year."
  • "Explain JOINs with this example."
  • "Make this query faster on 10 million rows."

Frequently asked questions

Do I need to know SQL?

No. Describe what you need in plain English and it explains the query.

Which databases does it support?

PostgreSQL, MySQL, SQLite, SQL Server, BigQuery, Snowflake and Supabase.

Can it fix my query?

Yes. Paste it and choose Fix my query or Speed up my query.

Is it safe to run update queries?

Always preview, back up and test on a copy first.

More Coding prompts

CodingPremium · FreeAny AI

Regex Builder & Explainer

Build regular expressions from plain English: validate emails, phone numbers and dates, find and replace text, or extract data, with each part explained, test cases that match and fail, and code for your language.

You’ll fill in

  • What to match
  • Should match
  • Should not match
  • Task
  • +3 more

7 detailsAbout 1 min

CodingPremium · FreeAny AI

API Integration Helper

Connect your app to an API like Stripe, OpenAI, Google Maps, WhatsApp, Shopify or any REST API: setup, authentication, requests, webhooks, error handling and working sample code, with keys kept safe.

You’ll fill in

  • Language and framework
  • Where it runs
  • API to connect
  • What I want to do
  • +4 more

8 detailsAbout 1 min

CodingPremium · FreeAny AI

Code Refactor & Clean-up

Make messy code cleaner, shorter and easier to maintain without changing what it does: better names, smaller functions, less duplication, modern syntax and clearer structure, with every change explained.

You’ll fill in

  • Language and framework
  • Code to refactor
  • What it does
  • Constraints
  • +3 more

7 detailsAbout 1 min

CodingPremium · FreeAny AI

Coding Interview Prep Coach

Prepare for technical and coding interviews: practice problems at your level, hints before answers, step-by-step solutions with time and space complexity, mock interview rounds and a study plan for your target role.

You’ll fill in

  • Target role and company type
  • Language
  • Current level
  • Interview date
  • +4 more

8 detailsAbout 1 min

CodingPremium · FreeAny AI

Vibe Coding App Starter

Turn an app or website idea into a clear build plan and ready-to-paste prompts for AI app builders like Lovable, Bolt, Replit, v0, Cursor and Claude Code, so you can build step by step without getting stuck.

You’ll fill in

  • App idea
  • Must-have features
  • Users and accounts
  • Data to store
  • +5 more

9 detailsAbout 2 min

CodingPremium · FreeAny AI

Code Review & Security Check

Get a senior-level code review: bugs, security holes such as injection and exposed keys, performance problems, readability and best practices, with every issue ranked by severity and a suggested fix.

You’ll fill in

  • Language and framework
  • Code to review
  • What it does
  • Context
  • +3 more

7 detailsAbout 1 min

← Back to the AI Prompt Library