Skip to content
flowchart.tools

SQL to ER diagram generator

Turn a schema dump into an entity-relationship diagram. Tables show their columns and keys, and every foreign key becomes a crow's foot relationship line.

4 tables, 4 relationships

Download

Runs in your browser. Nothing you type or drop here is uploaded.

How to use it

  1. Paste your schema: the output of pg_dump --schema-only, mysqldump --no-data, or CREATE TABLE statements you wrote by hand.

  2. Check the tables and relationships. Primary keys are marked PK and foreign keys FK. Each relationship line has a crow's foot on the referencing table and a single bar on the table it references.

  3. Open the diagram in the editor to group tables by domain, or download it for your documentation.

What the parser understands

Column names and types, inline PRIMARY KEY and REFERENCES, table-level PRIMARY KEY and FOREIGN KEY constraints including named ones, composite keys, quoted and schema-qualified identifiers, and ALTER TABLE … ADD FOREIGN KEY statements as written by pg_dump and mysqldump. Comments are ignored.

What it leaves out

Indexes, views, triggers and check constraints are skipped because they do not change the shape of an ER diagram. If a foreign key points to a table that is not in the pasted SQL, that table is drawn with a dashed outline so the relationship is still visible.

No database connection needed

Tools that reverse-engineer a live database need credentials and network access. This one works from text, which means you can use it on a production schema without giving anything access to production.

Start from a template

These templates are written in this tool's input format. Open one to edit its source here.

Guides that use this tool

Questions

Which SQL dialects work?
The parser targets the common subset of CREATE TABLE syntax shared by PostgreSQL, MySQL, MariaDB, SQLite and SQL Server. Dialect-specific options such as storage engines or partitioning clauses are ignored rather than rejected.
Does it show one-to-many versus many-to-many?
Yes, as far as SQL can say. Each foreign key is drawn in crow's foot notation: zero-or-many on the table that holds the key, exactly one on the table it points to. A many-to-many relationship appears as a join table with two such lines. In the editor you can change either end, for example to one-to-one.
Can I edit the diagram afterwards?
Yes. Open it in the editor: each table is one shape whose columns you edit as text, and relationship lines stay attached when you move tables.

Related tools