SQL Query Explainer

Paste a SQL query and get a clear, step-by-step explanation in plain English. Works for SELECT, JOIN, WHERE, GROUP BY, CTEs, UPDATE, INSERT and DELETE.

Examples:
SQL Query
Explanation
i
SELECT

This query reads rows from users (joined with orders) filtered by a WHERE condition, grouped into aggregates, sorted, limited to 10 rows.

Step-by-step

  1. 1
    Pick which columns to return (SELECT)

    Return 3 columns or expressions — including aggregate functions like COUNT().

    u.name, COUNT(o.id) AS total_orders, SUM(o.amount) AS revenue
  2. 2
    Read rows from the source table (FROM)

    Start with rows coming from `users u`.

    users u
  3. 3
    Combine with another table (LEFT JOIN)

    Join `orders o` to the current rows, keeping every row from the left table and matching rows from the right matching on ON o.user_id = u.id.

    LEFT JOIN orders o ON o.user_id = u.id
  4. 4
    Filter the rows (WHERE)

    Keep only rows matching the given condition — rows that evaluate to FALSE or NULL are dropped before grouping.

    u.signup_date >= '2024-01-01'
  5. 5
    Group rows into buckets (GROUP BY)

    Collapse rows into one group per distinct combination of 2 expressions. Aggregate functions in SELECT are then computed per group.

    u.id, u.name
  6. 6
    Filter groups (HAVING)

    Keep only groups whose aggregate result matches the condition. HAVING runs after GROUP BY, unlike WHERE which runs before.

    COUNT(o.id) > 5
  7. 7
    Sort the result rows (ORDER BY)

    Sort the final result set by the listed expressions. Use ASC for ascending or DESC for descending on each column.

    revenue DESC
  8. 8
    Limit how many rows are returned (LIMIT)

    Return at most 10 rows from the sorted result set.

    10
Tables referenced
usersorders
Columns selected
u.nameCOUNT(o.id) AS total_ordersSUM(o.amount) AS revenue

Why Explain SQL?

  • Onboard new team members faster
  • Understand legacy queries you didn't write
  • Review pull requests with more confidence
  • Learn SQL by seeing queries broken down
  • Document queries for runbooks and wikis

What It Detects

  • SELECT, INSERT, UPDATE, DELETE, MERGE
  • JOIN types (INNER, LEFT, RIGHT, FULL, CROSS)
  • WHERE, HAVING and filter conditions
  • GROUP BY with aggregates (SUM, COUNT, AVG…)
  • ORDER BY, LIMIT / OFFSET, DISTINCT
  • CTEs (WITH clauses) and subqueries

Privacy & Speed

  • 100% client-side — nothing is uploaded
  • Safe for production queries and PII schemas
  • No sign-up, no rate limits, no API keys
  • Instant — runs entirely in your browser
  • Free and open to use

About the SQL Query Explainer

The SQL Query Explainer takes a SQL statement and translates it into a plain-English, step-by-step description of what the query does. It identifies the statement type, the tables and columns involved, the filters applied, how rows are grouped or joined, and how results are ordered and limited.

It works entirely in your browser — your SQL is never uploaded to a server, so you can safely paste queries that contain proprietary table names, internal business logic, or sensitive filter values. It's designed for engineers, data analysts, students, and anyone who needs to quickly understand what a query will do before running it.

How to Use the SQL Query Explainer

  1. Paste your SQL query into the SQL Query box on the left, or click one of the example buttons (Simple SELECT, JOIN + Aggregate, CTE, Subquery, UPDATE, INSERT, DELETE).
  2. Click Explain — the right panel shows a one-sentence summary of the whole query.
  3. Read the Step-by-step breakdown — each clause (SELECT, FROM, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT) is explained in order with the exact SQL snippet highlighted.
  4. Check the Tables referenced and Columns selected chips to see at a glance what the query touches.
  5. Click Copy to copy the full explanation to your clipboard — handy for PR descriptions, tickets, runbooks, or code comments.
  6. Click Clear to start fresh, or load another example to compare different query shapes.

Common Use Cases

  • Onboarding — help new engineers or analysts understand existing queries without hand-holding from a senior.
  • Code reviews — paste a reviewer's query to instantly see the logic, joins, and filters described in English.
  • Legacy code — make sense of long, undocumented queries inherited from previous teams.
  • Learning SQL — students and self-taught developers can see exactly how each clause contributes to the result set.
  • Ticket descriptions — paste the explanation into a Jira or Linear ticket so non-technical stakeholders know what a query does.
  • Pre-run checks — before running a destructive UPDATE or DELETE in production, verify in plain English what rows will be affected.
  • Runbooks & wikis — generate quick written descriptions of canonical reporting queries for team documentation.

Frequently Asked Questions

Is my SQL sent to a server?

No. Explanation runs entirely in your browser using JavaScript. Your queries, table names, column names, and any literal values never leave your device, making this tool safe to use with production or sensitive queries.

Which SQL dialects are supported?

The explainer is dialect-agnostic and focuses on structural clauses common to most SQL flavors — ANSI SQL, MySQL, PostgreSQL, SQLite, T-SQL, BigQuery, Snowflake, Redshift, and others. Dialect-specific functions are preserved inside the explanation but not individually interpreted.

Does it actually execute the query?

No. The tool only analyzes the structure of your SQL — it never connects to a database and never runs the query. That means it is completely safe to paste UPDATE, DELETE, or DROP statements for explanation purposes.

Does it work with CTEs and subqueries?

Yes. WITH clauses (Common Table Expressions) are detected and listed with their names, and subqueries inside WHERE, FROM, and SELECT are preserved as-is inside the step that references them.

Can it explain JOINs?

Yes. The explainer detects INNER, LEFT, RIGHT, FULL OUTER, and CROSS joins, names the table being joined, and shows the ON condition used to match rows.

Why does the explanation look thin on very complex queries?

The explainer prioritizes clarity over depth. For deeply nested subqueries or vendor-specific constructs, it will summarize the top-level structure and keep the inner SQL visible in the step snippet rather than trying to paraphrase every detail. Break very long queries into smaller pieces for the clearest explanation.

Can I use this for commercial or private work?

Yes. The tool is free to use for any purpose — commercial, private, educational, or personal. Since nothing is transmitted off your device, there are no data-privacy concerns for internal business queries.

Does it check my query for bugs?

Not in the traditional sense — it doesn't run against a schema, so it can't catch typos in column names or type mismatches. But by reading the plain-English breakdown you'll often spot logical bugs (wrong join direction, missing WHERE clause, incorrect GROUP BY) before running the query.