Skip to main content

SQL ERD Generator

Paste your CREATE TABLE statements and get a structured text ERD with tables, columns, types, and relationship arrows. Detects PRIMARY KEY and FOREIGN KEY … REFERENCES automatically.

✓ Detects PK / FK automatically ✓ Relationship arrows between tables ✓ MySQL, PostgreSQL, SQLite syntax ✓ Runs 100% in your browser

Frequently Asked Questions

What SQL syntax does the ERD generator support?▼

The tool parses standard SQL CREATE TABLE statements compatible with MySQL, PostgreSQL, and SQLite. It recognises PRIMARY KEY constraints (both inline and table-level), FOREIGN KEY ... REFERENCES clauses, column data types, and NOT NULL / DEFAULT modifiers. Both backtick (MySQL) and double-quote (PostgreSQL) identifier quoting are handled.

How are relationships detected?▼

The parser looks for two patterns: (1) a column definition ending with REFERENCES table(column), and (2) a table-level FOREIGN KEY (col) REFERENCES table(col) constraint. Both forms produce a relationship arrow in the diagram. If neither is present the tables are shown as independent entities.

What do PK and FK mean in the diagram?▼

PK marks the primary key column(s). FK marks columns that are foreign keys pointing to another table. The arrow after the FK annotation shows the target table and column, e.g. FK → orders(id).

Why does my SQL not parse correctly?▼

The parser uses lightweight regex-based heuristics rather than a full SQL grammar, so very complex statements (WITH clauses, generated columns, multi-statement triggers) may not parse cleanly. Paste only the CREATE TABLE blocks, one per table, without surrounding procedure or transaction wrapper code.

Does this tool send my schema to a server?▼

No. All parsing and rendering runs entirely in your browser. Your schema text is never transmitted to any server.

Share this tool: X / Twitter LinkedIn
✓ 60,000+ developers use DevPlaybook ★★★★★ 4.8 / 5 on Gumroad ✓ MIT licensed · Instant download ✓ No login required

Related Products

on Gumroad

You Might Also Need

More Free Tools

Enjoying this tool? Get more like it.

Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.

DevPlaybook Pro 7 days free

Unlock AI-Powered Dev Tools

  • ⚡ AI Code Review, Doc Generator & SQL Builder
  • ⚡ All premium templates & early access
  • ⚡ Member discounts on Gumroad products
Start Free Trial →

$9/mo after trial · Cancel anytime

Want the full toolkit?

Get DevPlaybook Pro

Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.

$79
$241 separately Save $162 (67% off)
Get DevPlaybook Pro — $79 →

MIT licensed · Instant download · No subscription

See what's included → Browse all deals →