Paste your DDL, get an ERD.
LetDraw turns SQL to ER diagram in one paste. Drop in your CREATE TABLE statements and get every table, column, primary key and foreign key laid out as editable shapes, with relationships drawn between the tables. Postgres, MySQL and standard SQL all work.
How to turn SQL into an ER diagram
From a migration file or a schema dump to an editable diagram in under a minute.
Copy your DDL
Grab the CREATE TABLE statements from your migrations or a schema-only dump. Comments are ignored, so you can paste the file as it is.
Paste it into Generate from Code
Open Generate from Code (a Pro feature) from the More tools menu and paste. The SQL is detected automatically and a live preview appears.
Pick the relationship style
Show foreign keys as a plain line, a straight arrow, a smart routed connector or crow's foot ER notation.
Insert and share
Drop the ERD on the canvas, rearrange or annotate it, then share a link or export it as PNG, SVG or PDF.
From CREATE TABLE to diagram, column by column
Each table becomes a grid with a header and one row per column, showing the type next to the name. Primary keys and foreign keys are marked, long types are shortened (timestamptz, varchar), and the tables are arranged in a tidy grid. Everything is made of normal LetDraw shapes, so every cell stays editable. While the generated ERD is unchanged, Diagram to Code gives it back as Mermaid erDiagram code.
- Postgres, MySQL and standard SQL, including quoted names, schema prefixes and IF NOT EXISTS
- Keys detected: PRIMARY KEY, UNIQUE, NOT NULL, inline REFERENCES and FOREIGN KEY constraints
- Crow's foot cardinality inferred from each foreign key column (NOT NULL, UNIQUE)
Why teams turn SQL into ER diagrams
A schema is easier to discuss when everyone can see the tables and how they connect.
Onboarding new developers
Give newcomers a map of the database on day one instead of a folder of migration files.
Reviewing migrations
Paste the new tables next to the old ones and talk about the change on a shared canvas.
Docs and READMEs
Export the ERD as PNG, SVG or PDF and drop it into your docs, wiki or design notes.
Legacy schema audits
See an inherited Postgres or MySQL schema at a glance and spot the tables nothing points to.
Design reviews
Sketch a new feature's tables, generate the diagram and leave comments right on the relationships.
Teaching databases
Show students how keys and foreign keys become one-to-many relationships with crow's foot ends.
SQL to ER diagram FAQ
Which SQL can I paste?
Is my schema uploaded anywhere?
Is it free?
Can I edit the diagram or get code back?
More ways to diagram from code
Your schema, as a diagram, in one paste.
Open LetDraw, paste your CREATE TABLE statements and watch the tables and relationships appear.