Turn SQL into an ER diagram
Paste your CREATE TABLE statements or open a .sql file. The diagram draws itself, and you can download it as SVG or PNG.
- Free, no sign-up
- Nothing uploaded
- SVG, PNG, Mermaid, DBML
or drop one here · PostgreSQL, MySQL, SQLite, SQL Server
No SQL handy? Try one:
How it works
- Paste the tables. CREATE TABLE statements with their keys, plus any ALTER TABLE ... ADD CONSTRAINT and CREATE INDEX lines. A whole
pg_dump --schema-onlyormysqldump --no-datafile works; data and other statements are skipped. - It draws the relationships. Every foreign key becomes a line from the column to the key it references. Tables that are referenced sit to the left of the tables that point at them.
- Read the ends. In crow's foot, the fork is the "many" side, two bars mean exactly one, and a circle means zero is allowed (the foreign key column can be NULL). Switch to 1 and N if you prefer labels.
- Check the design. The page lists tables without a primary key, foreign keys without an index, money in FLOAT, dates stored as text, columns that look like foreign keys but are not, and more, with SQL to fix each one.
Questions
- Is my SQL uploaded?
- No. The SQL is read and drawn inside your browser tab. Only the optional AI review sends it, and only when you press its button.
- Which databases does it read?
- PostgreSQL, MySQL and MariaDB, SQLite and SQL Server: CREATE TABLE with column and table constraints, ALTER TABLE ADD CONSTRAINT and ADD COLUMN, and CREATE INDEX. Other statements, such as INSERT or CREATE VIEW, are skipped.
- How do I get my tables as SQL?
- PostgreSQL: pg_dump --schema-only. MySQL: mysqldump --no-data, or SHOW CREATE TABLE. SQLite: .schema in the sqlite3 shell. SQL Server: Generate Scripts in SSMS. Most ORMs can print their migrations as SQL.
- Can I edit the diagram in another tool?
- Yes. The SVG opens in Figma, Illustrator, Inkscape and browsers; the Mermaid text renders in GitHub, GitLab and Notion; the DBML imports into dbdiagram.io.
- A line points at a dashed box.
- That foreign key references a table that is not in what you pasted. Paste that table too, or ignore it if it lives in another database.
- What does the AI review add?
- Design points the free checks cannot see, such as a natural key that is not unique or a fact stored twice. It does not repeat the free checks; it says which of them it agrees with.