Explain a SQL query in logical processing order from rows to final result.
The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.
Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.
The query is summarized through FROM and joins, WHERE, grouping, HAVING, projection, DISTINCT, ordering, and LIMIT. The explanation describes semantics without executing the statement or reading data.
SELECT u.name, COUNT(o.id) as order_count FROM users u LEFT JOIN orders o ON u.id = o.user_id WHERE u.active = true GROUP BY u.name HAVING COUNT(o.id) > 5 ORDER BY order_count DESC LIMIT 10
This query retrieves data: - Selects 2 column(s): u.name, COUNT(o.id) as order_count - From the "users" table - LEFT JOINs with "orders" - Filters rows where: u.active = true - Groups results by: u.name - Filters groups where: COUNT(o.id) > 5 - Orders results by: order_count DESC - Limits to 10 row(s)
Query teaching, code reviews, and support investigations explain SQL results.