SQL DDL to Mermaid ERD & Database Diagram Guide
Transform CREATE TABLE SQL statements into interactive entity relationship diagrams (ERD) powered by Mermaid.js. Visualize table structures, primary keys, and foreign key relationships with zero server upload, and export high-resolution SVG, PNG, or Markdown code.
DDL statements are parsed in client-side JavaScript using regex pattern matching that recognizes composite keys, constraint clauses, table quotes, and comments. Diagram rendering is performed locally by mermaid.js directly into browser SVG elements without calling any external rendering APIs.
✨ Core Capabilities
- •Universal SQL compatibility: supports CREATE TABLE DDL from MySQL, PostgreSQL, Oracle, SQLite, and SQL Server.
- •Automated relationship mapping: detects CONSTRAINT FOREIGN KEY and inline REFERENCES to draw one-to-many ERD lines.
- •High-resolution export: download crisp vector SVG or 2x scaled PNG images ready for architectural presentations and documentation.
- •1-click Markdown copy: export Mermaid syntax code directly for embedding into GitHub READMEs, PR reviews, Notion, and Obsidian.
- •100% in-browser processing: your confidential database schemas and column definitions never leave local memory.
🚀 Step-by-Step Guide
- 1. Paste your CREATE TABLE DDL statements into the left SQL editor, or click "Load Sample" to try the demo schema.
- 2. View the rendered Mermaid ERD diagram in real-time on the right panel.
- 3. Use the zoom controls (+ / -) to inspect complex schemas, or switch to the "Code" tab to view raw Mermaid markdown.
- 4. Click "SVG 저장" or "PNG 저장" to download the diagram, or copy the Mermaid code to your clipboard.
🔬Verified Input & Output Examples (Before / After)
Converts relational SQL CREATE TABLE definitions into Mermaid.js ERD syntax with one-to-many relationship indicators.
CREATE TABLE users ( id INT PRIMARY KEY, email VARCHAR(255) NOT NULL ); CREATE TABLE orders ( id INT PRIMARY KEY, user_id INT, total DECIMAL(10,2), CONSTRAINT fk_user FOREIGN KEY (user_id) REFERENCES users(id) );
erDiagram
users ||--o{ orders : "fk_user"
users {
int id PK
varchar email
}
orders {
int id PK
int user_id FK
decimal total
}