This tool turns a basic SQL SELECT query into a step-by-step flowchart: scan the table, filter rows, project columns, sort, and return results. SQL’s written order (SELECT first) is not its execution order (FROM first, then WHERE, then SELECT), and that mismatch confuses every beginner. A flowchart that follows execution order makes the logic visible: the database first finds the table, then keeps only matching rows, then keeps only requested columns, then sorts. The parser’s limits are stated plainly: SELECT, FROM, WHERE, and ORDER BY only — no JOINs, subqueries, aggregations, or GROUP BY. Inside those limits, it is a precise teaching aid.
How to use it
- Write or paste a basic SELECT query.
- Click Draw flowchart.
- Read the steps in execution order, top to bottom.
- Compare the flowchart order with the written SQL order.
- Rewrite the query and redraw to test your understanding.
Worked example
The query SELECT name, age FROM students WHERE age > 18 ORDER BY age becomes four steps: scan students, filter rows where age > 18, project name and age, sort by age. A student who thought SELECT runs first now sees why WHERE can use columns that SELECT never outputs: filtering happens before projection, so a condition on a hidden column is perfectly legal. Another student who wondered why ORDER BY can sort by an unselected column sees the same answer: sorting happens after projection in this simplified model, but the engine keeps what it needs. The flowchart answers the “why does this work?” questions that syntax alone never does.
Honest limits
The parser is deliberately small. JOINs, subqueries, UNION, GROUP BY, HAVING, window functions, and aggregations are all rejected with a clear message rather than mis-parsed, because a flowchart that silently misrepresents a query is worse than none. Real query planners also reorder operations for performance — filtering may use an index, projection may be pushed down — so the flowchart shows logical order, not the engine’s physical plan. For production query analysis, use EXPLAIN in your database; this tool is for learning the logic, not tuning performance.
Who it is for
This tool is for students learning SQL, teachers demonstrating execution order, and analysts who want a quick visual check of a simple query’s logic. It pairs well with a real database: draw the flowchart here, then run the query there and compare the result row by row.
Going further
Teach the execution-order habit with a small exercise: give students a query and ask them to list the steps before running it, then reveal the flowchart and discuss any step they missed — usually the filter-before-project insight or the fact that ORDER BY is the only clause guaranteed to order results. A second exercise: ask which columns WHERE may reference (any table column) versus which SELECT outputs (only listed ones), and let the flowchart settle arguments. Students who internalize execution order stop writing queries by trial and error and start writing them by reasoning, which is the difference between knowing SQL syntax and understanding SQL. Use the flowchart to debug “empty result” queries, the most common beginner frustration. Walk the steps: did the FROM table contain the rows you expected, did WHERE filter them all away, did a typo in a column name silently change the filter? Most empty results come from an over-strict WHERE or a wrong table, not from missing data, and the step-by-step walk finds the culprit faster than staring at the query text. Teach students to narrate each step aloud before running anything — the narration habit catches more bugs than any syntax checker. Extend the habit beyond SELECT: for any query, ask what each clause contributes before running it, and predict the row count roughly. A WHERE that should keep half the rows but keeps none, or a JOIN that multiplies rows unexpectedly, announces itself immediately against a prediction, while a result accepted without one can mislead for weeks. Prediction before execution is the cheapest debugging tool in SQL, and flowcharts are simply predictions made visible. Make it a classroom rule: no query runs without a predicted shape first.
Related tools
Versión en español · Schema Version Control Dashboard · All free online tools.
Embed this tool on your website — free
Copy the code below to add this working tool to your own page. A small credit link stays with it — that’s all we ask.
