xutil.dev
Login

SQL Query Visualizer

Visualize SELECT statement structure. Table join diagrams, execution order, and color highlighting help understand and debug complex SQL queries

SQL Query
Syntax Highlighting
SELECT
  u.id,
  u.name,
  COUNT(o.id) AS order_count,
  SUM(o.total) AS total_spent
FROM users u
LEFT JOIN orders o ON u.id = o.user_id
WHERE u.active = 1
  AND o.created_at > '2024-01-01'
GROUP BY u.id, u.name
HAVING COUNT(o.id) > 5
ORDER BY total_spent DESC
LIMIT 10
Execution Order
1
FROM

Identify the source table

2
JOIN

Execute table joins

3
WHERE

Apply row filtering conditions

4
GROUP BY

Group rows together

5
HAVING

Apply group filtering conditions

6
SELECT

Select output columns

7
ORDER BY

Sort the results

8
LIMIT / OFFSET

Limit the number of result rows

Query Structure
SELECT
u.id
u.name
COUNT(o.id) AS order_count
SUM(o.total) AS total_spent
FROM
users (u)
JOIN
LEFT JOIN orders (o)
ON u.id = o.user_id
WHERE
u.active = 1 AND o.created_at > '2024-01-01'
GROUP BY
u.id, u.name
HAVING
COUNT(o.id) > 5
ORDER BY
total_spent DESC
LIMIT / OFFSET
LIMIT 10
Table Relationship Diagram
users
(u)
LEFT JOIN
u.id = o.user_id
orders
(o)