No installation required. Runs entirely in your browser.
Introduction
When working with existing systems, have you ever struggled with complex SQL like this?
- Too many JOINs to understand the structure
- Hard to visualize table relationships
- No ER diagram available I had the same problem, so I built a tool that generates ER diagrams directly from SELECT queries.
π Try it here: SQL2ER
β
What This Tool Does
You can paste a SELECT query, and it will automatically generate an ER diagram based on JOIN relationships.
Example
SELECT
u.name,
o.id,
p.name
FROM users u
JOIN orders o ON u.id = o.user_id
JOIN order_items oi ON o.id = oi.order_id
JOIN products p ON oi.product_id = p.id;
π
The tool analyzes JOIN conditions like:
u.id = o.user_id
and converts them into relationships between tables.
Why This Is Useful
Most existing tools (like DDL-based ER generators) require CREATE TABLE statements.
However, in real-world scenarios:
- You often only have SELECT queries
- Youβre analyzing legacy systems
- You want to quickly understand relationships π This tool works without any DDL
Key Features
- No installation required (runs in browser)
- Works with plain SELECT queries
- Supports multiple JOINs
- Handles table aliases
How It Works
The logic is simple:
SELECT query
β
Parse JOIN and ON clauses
β
Extract relationships
β
Generate ER diagram
Specifically, it detects patterns like:
table1.column = table2.column
and builds connections from them.
Use Cases
- Understanding legacy systems
- SQL code reviews
- Learning database relationships
- Debugging complex queries
Try It Yourself
π http://trancelens.com/sql2er/en/index.html
Paste your SQL and see the structure instantly.
Final Thoughts
There are many tools that generate ER diagrams from CREATE statements.
But generating them from SELECT queries turned out to be surprisingly useful in practice.
If you deal with SQL regularly, this might save you a lot of time.
Feedback
Iβd love to hear your fee



Top comments (0)