SQL Query Explainer
See a best-effort outline of one SELECT query's top-level clauses. SQL stays in your browser and is never executed; nested or dialect-specific syntax may not be recognized.
Supports one SELECT statement, optionally preceded by WITH CTEs. Only top-level clauses are outlined; dialect-specific syntax may not be recognized. SQL stays in your browser and is never executed. Maximum: 50,000 UTF-16 code units. Press Ctrl+Enter or Command+Enter to explain.
Query structure
Found 8 top-level sections. This is a structural outline, not SQL validation or query results.
WITH / CTE
Defines named intermediate queries used by the SELECT. CTE contents are kept together in this outline.
WITH recent_orders AS ( SELECT user_id, total FROM orders WHERE created_at >= '2025-01-01' )SELECT
Lists the expressions or columns in the result. It does not show returned data.
SELECT users.name, COUNT(recent_orders.total) AS order_countFROM
Names the data sources; joins and their conditions stay in this section.
FROM users LEFT JOIN recent_orders ON recent_orders.user_id = users.idWHERE
Filters source rows before grouping and aggregation.
WHERE users.active = TRUEGROUP BY
Groups source rows for aggregate expressions.
GROUP BY users.nameHAVING
Filters groups after aggregation.
HAVING COUNT(recent_orders.total) > 0ORDER BY
Specifies the order of the query results.
ORDER BY order_count DESCLIMIT
Requests a maximum number of rows where supported.
LIMIT 20;