💙 Supporting healthcare non-profits: Metadataloop is free for 6–12 months. Contact Us to get started.
Free Online Tool

SQL to Mermaid erDiagram Converter

Paste CREATE TABLE statements, get Mermaid erDiagram markup ready for GitHub, Notion, and Markdown.

Open the Mermaid / DBML Converter →

Overview

Mermaid renders ER diagrams natively in GitHub, GitLab, Notion, and most static-site generators — but writing the syntax by hand is slow. Paste any number of CREATE TABLE statements and MetaDataLoop emits Mermaid erDiagram markup with column types, primary keys (PK), foreign keys (FK), and detected relationships drawn as ||--o{ etc.

What you get

✓ INCLUDED
Reads PostgreSQL, MySQL, Snowflake, and SQL Server DDL
✓ INCLUDED
Emits PK / FK markers and cardinality (||--o{, }|--||, }o--o{)
✓ INCLUDED
Renders directly in GitHub README, GitLab MR, Notion blocks
✓ INCLUDED
Includes column types so the diagram doubles as a data dictionary
✓ INCLUDED
Free — no signup, no install, no API key

Example

Input
CREATE TABLE users (
    id INT PRIMARY KEY,
    email VARCHAR(255)
);

CREATE TABLE orders (
    id INT PRIMARY KEY,
    user_id INT,
    total DECIMAL(10,2),
    FOREIGN KEY (user_id) REFERENCES users(id)
);
Output
erDiagram
    users ||--o{ orders : has
    users {
        int id PK
        varchar email
    }
    orders {
        int id PK
        int user_id FK
        decimal total
    }

Frequently asked questions

Where can I render the output?
Mermaid is supported in GitHub Markdown (in ```mermaid blocks), GitLab, Notion, Obsidian, mermaid.live, and most modern docs tools.
Does it detect cross-schema FKs?
Yes if the REFERENCES clause uses schema.table syntax. We strip the schema for the diagram label but keep the relationship.
What if my SQL has dialect-specific syntax?
We tolerate most variants — backtick quoting, square brackets, IF NOT EXISTS, INHERITS, etc. Drop in your DDL and try.

Try it now

No signup, no install — runs entirely in your browser.

Open the Mermaid / DBML Converter →

⚠ Confirm Delete