🍱 Lunchbox Hands

SQL Explainer

Explain any SQL query in plain English, clause by clause

Paste any SQL query and instantly see what it does β€” in plain English, broken down clause by clause. No AI, no guesswork: the tool uses a real SQL parser that produces a deterministic explanation every time. Everything runs locally in your browser; your queries are never sent anywhere.

No AI β€” deterministic parser β€” runs entirely in your browser

What SQL Explainer does and why it's useful

SQL is a declarative language β€” you describe what data you want, not how to retrieve it. That makes it powerful and concise, but also opaque to anyone who didn't write the query. A dense 30-line query with multiple JOINs, a subquery in the WHERE clause, and a HAVING filter can take several minutes to mentally parse even for experienced developers.

SQL Explainer addresses this by turning a query into a structured, clause-by-clause breakdown in natural language. The tool uses node-sql-parser, a production-grade open-source parser that builds a full abstract syntax tree (AST) from your query. The explanation engine then walks that tree and converts each node β€” column references, operators, aggregates, join conditions β€” into readable English. Because the output comes from a parser rather than a language model, it is deterministic: the same input always produces the same output.

Common use cases include onboarding onto a new codebase, auditing unfamiliar queries before running them in production, documenting query logic for non-technical stakeholders, and learning SQL by seeing how each clause translates to plain language.

Supported SQL constructs

  • SELECT β€” column lists, SELECT *, DISTINCT, aliases, aggregate functions (COUNT, SUM, AVG, etc.), and window functions.
  • FROM & JOINs β€” multiple tables, table aliases, and all join types: INNER, LEFT, RIGHT, FULL OUTER, and CROSS. Each join's ON condition is translated individually.
  • WHERE β€” comparisons (=, >, <, !=), AND/OR trees, IN, NOT IN, LIKE, BETWEEN, and IS NULL / IS NOT NULL.
  • GROUP BY, HAVING β€” grouping columns and post-aggregation filters.
  • ORDER BY β€” one or more columns, each with ASC or DESC direction.
  • LIMIT / OFFSET β€” maximum row counts and pagination offsets.
  • INSERT, UPDATE, DELETE β€” table name, column assignments, and WHERE conditions.
  • CREATE TABLE β€” table name and column list with data types.

How to use this tool

  1. Choose the SQL dialect that matches your database from the dropdown. Postgresql is the default and works for most standard SQL.
  2. Paste your query into the text area. The explanation updates automatically as you type (after a short debounce).
  3. Read the plain-English summary for a one-sentence overview of the entire query.
  4. Scroll through the clause-by-clause breakdown to understand each part individually β€” FROM, JOINs, WHERE, ORDER BY, and so on.
  5. If the parser returns a red error box, double-check that your SQL is valid for the selected dialect. Selecting the correct dialect often resolves syntax issues (e.g. MySQL backtick quoting vs Postgresql double-quote quoting).

Related tools

  • Need to clean up the formatting of a query before explaining it? Run it through the SQL Formatter first to get consistently indented, readable SQL.
  • Working with CSV data that needs to become SQL? The CSV to SQL INSERT converter turns spreadsheet rows into ready-to-run INSERT statements β€” useful when you want to understand what those statements do after generating them.

Frequently asked questions

Does this tool use AI or a language model?

No. This tool uses node-sql-parser, an open-source SQL parser that generates an abstract syntax tree (AST) from your query. The plain-English explanation is produced by deterministic code that reads the AST nodes β€” no model, no API call, no randomness. The same query always produces the same explanation. Your query never leaves your browser.

Which SQL dialects are supported?

The tool supports Postgresql (the default), MySQL, MariaDB, SQLite, TransactSQL (T-SQL for SQL Server), BigQuery, DB2, and Hive. Select your dialect from the dropdown before explaining. Dialect affects which syntax variants the parser accepts β€” for example, backtick-quoted identifiers in MySQL versus double-quoted in Postgresql.

What statement types can it explain?

SELECT (including JOINs, subqueries, window functions, CTEs), INSERT, UPDATE, DELETE, and CREATE TABLE are all supported with clause-by-clause breakdowns. More exotic DDL statements (ALTER TABLE, CREATE INDEX, etc.) are recognised and returned with a basic type label. If a statement type is too unusual for the parser to handle it will return a clear parse error rather than silently producing a wrong explanation.

Can it explain complex JOINs and subqueries?

Yes. JOINs are identified by type (INNER, LEFT, RIGHT, FULL OUTER, CROSS) and the ON condition is translated to plain English. Subqueries in FROM, WHERE, and SELECT positions are noted as "subquery" in the explanation. For queries with multiple JOINs, each join gets its own entry in the clause breakdown.

Why does the explanation say "?" for some identifiers?

A "?" appears when the parser produces an AST node whose shape is not yet mapped to a human-readable form. This can happen with very uncommon syntax, vendor-specific extensions, or edge cases in the AST format. If you encounter one, try selecting the matching dialect in the dropdown β€” it often resolves the issue by using the correct parser grammar for your SQL flavor.

Get weekly dev tools and tips