Paste a query and see it taken apart — statement type, tables, columns, joins and conditions, each clause explained in a sentence, plus the query re-formatted and graded warnings. Handles SELECT , INSERT , UPDATE and DELETE .
SELECT statement on USERS, ORDERS with 1 JOIN, 3 aggregates, 1 condition
SELECT u.name, COUNT(o.id) AS orders, SUM(o.total) AS spend FROM users u JOIN orders o ON u.id = o.user_id WHERE u.created_at > '2024-01-01' GROUP BY u.name HAVING COUNT(o.id) > 3 ORDER BY spend DESC LIMIT 20;
Specifies which columns or expressions to include in the result set.
Identifies the source table(s) to query. Multiple tables separated by commas create a Cartesian product.
Combines rows from two tables based on a related column.
Filters rows before aggregation. Only rows satisfying all conditions are included.
Collapses rows with the same values in the specified columns into summary rows, enabling aggregate functions.
Filters groups after aggregation (like WHERE but for GROUP BY results).
Sorts the final result set. ASC is ascending (default), DESC is descending.
Caps the result at 20 rows — useful for pagination.
marduc812
© 202620260824_1c411cc