SQL to ER Diagram: Visualize Your Database Schema Instantly
Understanding database relationships is crucial for developers, DBAs, and architects. Our SQL to ER Diagram tool takes your CREATE TABLE statements and generates a visual Entity-Relationship diagram using Mermaid.js—all in your browser, with no data sent to any server.
How It Works
- Paste your SQL - Enter one or more CREATE TABLE statements
- Click Generate - The tool parses tables, columns, and foreign keys
- View the diagram - See relationships rendered as an ER diagram
- Copy Mermaid code - Use in documentation, README files, or Mermaid-enabled tools
Supported SQL Features
Table Parsing
- • CREATE TABLE statements
- • Column names and types
- • Backtick and quote handling
Constraint Detection
- • PRIMARY KEY indicators
- • FOREIGN KEY relationships
- • UNIQUE constraints
Understanding the Diagram
| Symbol | Meaning |
|---|---|
| ||--o{ | One-to-Many relationship |
| ||--|| | One-to-One relationship |
| PK | Primary Key |
| FK | Foreign Key |
Why It's Free & Private
This tool uses Mermaid.js for client-side rendering. Your SQL never leaves your browser—there's no server processing, no data storage, and no tracking. The generated Mermaid code can be used anywhere that supports Mermaid diagrams, including GitHub, GitLab, Notion, and many documentation tools.
What if my SQL uses non-standard syntax?
The parser handles common MySQL, PostgreSQL, and SQLite syntax. It's designed to be forgiving with variations in formatting. However, very complex constraints or database-specific features may not be fully parsed. The tool focuses on extracting table names, columns, primary keys, and foreign key relationships.