-
-
WHERE in action: every row is tested, with a clear reason for why it stays or is removed.
-
Learn from mistakes: see why a column alias created by SELECT cannot be used in WHERE.
-
The final result: the top two departments, ranked by average CGPA.
-
The execution tree shows the logical order of the query from top to bottom, one step at a time.
-
Compare how the table changes after each step, all in one view.
-
Inside a transaction, DELETE removes rows while a savepoint keeps the option to roll back.
-
The same step-by-step learning experience in dark mode.
-
LEFT JOIN matches students with enrollments and keeps unmatched students with NULL values.
-
Follow the query's journey through a flow chart, with the current step highlighted.
-
GROUP BY collects students from the same department into colour-coded, labelled groups.
Inspiration
The tech industry is going through an extreme AI boom, but AI itself depends on one thing: data. To manage and understand data, we need databases, DBMS and, most importantly, SQL.
Beginners often write a query and see only the final result. Why did a row disappear? How were the groups formed? I wanted to make that hidden process visible, so learners can understand SQL instead of memorizing it.
What it does
QueryLens shows how SQL runs, one step at a time. Write a query, press Space, and watch rows being filtered, grouped, joined, sorted and limited.
- Highlights the clause being executed and explains each step
- Shows why a row is kept or removed
- Presents all table versions, an execution tree and a flow chart
- Covers queries, joins, subqueries, table and data changes, permissions and transactions
- Simulates behaviour of MySQL, PostgreSQL, SQL Server and SQLite
How I built it
I built QueryLens solo.
- Frontend: React, JavaScript, HTML, CSS and Vite
- SQL engine: a custom engine in the browser (lexer → parser → executor)
- Backend: Java and Spring Boot, which compares MySQL
SELECTresults with a local MySQL database - Tools: Spring Initializr, Maven, Spring Tool Suite, Vitest and AI assistance from Claude
The executor saves a snapshot after every step. The interface moves between these snapshots, so going forward and backward is simple.
Challenges I ran into
- Showing intermediate results: a database normally returns only the final output, so the engine had to record every step.
- Database differences: row limits,
NULLordering, division and text comparison behave differently. - Matching real behaviour: small details, such as how MySQL treats
'a' || 'b', needed correction. - Keeping it small: tables, explanations, a tree and a flow chart had to fit one clear screen.
Accomplishments that I am proud of
- One focused feature on one screen, true to the Smallest Possible Product theme
- Visualization that works in the browser without a database setup
- Step-by-step learning controlled by the Space key
- Keyboard support, symbols alongside colours, dark mode and a phone layout
What I learned
The order we write SQL differs from its logical execution order:
FROM → JOIN → WHERE → GROUP BY → HAVING → SELECT → DISTINCT → ORDER BY → LIMIT
I also learned about three-valued logic: comparing with NULL using operators such as = or > gives UNKNOWN, and WHERE keeps only true rows.
What's next for QueryLens
- Support
UNION, window functions, views and subqueries inFROM - Let learners create practice challenges with their own sample data
- Add guided lessons for common SQL mistakes

