Best SQL to ER diagram tools for schema documentation

Seven ways to turn SQL or a live database into an ER diagram, compared by what each is best for. Flowgraph Studio comes first when you want editable Mermaid from a schema file.

Roundups · · 5 min read

Flowgraph Studio is our product. We've tried to describe the other tools fairly, from their own documentation as of November 2026.

If you have a SQL schema file and want an editable Mermaid ER diagram for a design review or a handbook, Flowgraph Studio is the one to start with. The choice changes if you need to explore a live database, maintain a formal database model, or generate SQL from that model. This roundup ranks the path from DDL to documentation someone can review and edit.

Start with a schema-only file. Table definitions and constraints are all you need, and leaving out the data rows makes the sample safe to share. A small fixture with a required foreign key, an optional relationship, a unique foreign key and a junction table tells you more about accuracy than a hundred plain tables.

A SQL file flows into an ER diagram of two tables, then into three checks: skipped statements, keys and the optional side of each relationship
Converting the schema is the quick part. The review of what was read, and what was skipped, is what makes the diagram dependable.

1. Flowgraph Studio: best for SQL to editable Mermaid

In Projects, choose New diagram → Start from → From a SQL schema, then paste the DDL or drop a .sql file. The schema is read in your browser and nothing is uploaded. PostgreSQL works best, including pg_dump --schema-only output, and common MySQL table syntax mostly works too.

The importer reads CREATE TABLE with its keys, UNIQUE, NOT NULL and REFERENCES, unique indexes, and the changes migrations make: added, dropped, renamed or retyped columns, added and dropped constraints, renamed and dropped tables. Statements apply in order, so a file of migrations gives the schema as it ends up. Anything else is skipped and listed with its line number, and if a skipped statement changes tables, the import says the diagram may be out of date.

The result is Mermaid ER code. Open Manual mode to move entities, draw relationships, pick the cardinality at each end and edit keys, while the code updates beside the canvas. For a whole folder of migrations in a repository, the repository import replays them in order in the same way.

Convert SQL to an ER diagram · Edit an ER diagram in Manual mode · Keep a large database readable

2. dbdiagram.io: best when the team works in DBML

dbdiagram.io is a good choice when the database model itself is the working file. You write the schema in DBML and see the diagram beside it, then export a PDF or PNG or generate SQL. It imports SQL from several dialects, and its command-line tools convert SQL to DBML and back, or read a live database into DBML. The handoff is a DBML file, which suits a team that has standardised on it.

dbdiagram editing basics · DBML CLI · Generate DBML from a database

3. MySQL Workbench: best for a MySQL EER model

MySQL Workbench imports tables, views, routines, indexes, keys and constraints from a SQL script into a model, and can place them on an EER diagram. It also forward-engineers a model to DDL and reverse-engineers a live server. Use it when the input is MySQL and the next step is editing the MySQL design, rather than a compact figure for Markdown.

Reverse engineering a CREATE script · Forward and reverse engineering

4. DBeaver: best for exploring a connected database

DBeaver opens an ER diagram for a table, a view or a whole schema of a connected database. Custom diagrams take any tables you drag in, even from different connections, and you can add notes. Changes to a custom diagram never touch the database. It is the right tool when you have approved read access and want to see what is actually deployed.

DBeaver ER diagrams · Custom diagrams

5. pgAdmin: best for an existing PostgreSQL workflow

pgAdmin's ERD tool generates a diagram from a database, a schema or a table, and generates ready-to-run DDL from a design. Pick it when the maintainers already administer PostgreSQL in pgAdmin. Decide whether the handoff is a snapshot of the database or a design you keep editing.

pgAdmin ERD tool

6. SchemaCrawler: best for scripted schema diagrams

SchemaCrawler connects to a database and generates diagrams from its metadata: Graphviz images, and also Mermaid ER diagrams, PlantUML and DBML. When the schema changes, you run it again. That suits periodic reports and anyone who wants the diagram regenerated by a script. A full generated diagram can sit beside a smaller one that explains a single area.

SchemaCrawler diagramming

7. SchemaSpy: best for browsable schema documentation

SchemaSpy connects to a database through a JDBC driver and generates HTML documentation, ER diagrams included. Current versions draw the diagrams with a bundled copy of Graphviz (viz.js), so there's nothing extra to install. Use it when people need to browse every table of a database that already exists.

SchemaSpy · Installation

Use a small schema fixture

CREATE TABLE accounts (
  id INTEGER PRIMARY KEY
);

CREATE TABLE billing_profiles (
  id INTEGER PRIMARY KEY,
  account_id INTEGER NOT NULL UNIQUE REFERENCES accounts(id)
);

An account can have zero or one billing profile. Each profile belongs to exactly one account, through a required, unique foreign key. Check that the tool shows both halves of that: one account per profile, and an account that can exist without a profile. This is what Flowgraph Studio's importer gives for the file above:

erDiagram
  accounts {
    integer id PK
  }
  billing_profiles {
    integer id PK
    integer account_id FK, UK
  }
  accounts ||..o| billing_profiles : "account_id"

Now remove UNIQUE from a copy of the file. The model should change to allow many profiles per account, and Flowgraph's line becomes ||..o{. A column named account_id is not proof that a foreign key exists, and a "one-to-one" label is ambiguous if readers can't tell which side is optional.

Check what a migration file leaves behind

Real schemas arrive as migrations. Try a file that creates a table, renames it, adds the foreign key in a later statement, and creates a view:

CREATE TABLE accounts (id INTEGER PRIMARY KEY);
CREATE TABLE invoices (id INTEGER PRIMARY KEY, account INTEGER);
ALTER TABLE invoices RENAME TO bills;
ALTER TABLE bills ADD CONSTRAINT bills_account_fk
  FOREIGN KEY (account) REFERENCES accounts(id);
CREATE VIEW open_bills AS SELECT * FROM bills;

Look for the final table name and the relationship. Flowgraph draws bills, not invoices, with an optional link to accounts because the column allows nulls, and lists the CREATE VIEW on line 6 as skipped. Whatever tool you choose, record what it left out, so a reviewer can tell whether the image is a draft, a schema snapshot or a partial import. If a tool reads live metadata, run the test only against an approved test database.

Verdict: Flowgraph Studio wins for SQL-to-ER documentation when the team wants the imported relationships as editable Mermaid and a clear image to publish. Choose a database tool when the next step is exploring or engineering the actual database. Open Flowgraph Studio

One-to-one comparisons

More from the blog

Follow the blog by RSS