YAMLTools logo

SQL to ER Diagram & Database Documentation

Paste your CREATE TABLE statements or a whole SQL dump and get an entity-relationship diagram, a relationships map and readable documentation. PostgreSQL, MySQL and SQLite.

Schema Visualizer

Visualize your database schemas with multiple diagram types

SQL
Loading editor…

Try a real schema

Click an example and we will load the SQL into the tool above. There is one per dialect: PostgreSQL, MySQL and SQLite.

Multi-tenant SaaS (PostgreSQL)

Organizations, users and projects with an enum type, UUIDs, JSONB, comments and a join table that becomes an N:M relationship.

Online shop (MySQL)

Customers, products and orders with backticks, AUTO_INCREMENT, an inline ENUM and named foreign keys.

Notes app (SQLite)

Notebooks, notes and tags with INTEGER PRIMARY KEY AUTOINCREMENT and inline REFERENCES.

Key Features

Everything you need to understand a database from its SQL

Reads real dumps

Paste the output of pg_dump or mysqldump as is. Functions, triggers, DO blocks, INSERT and COPY data are skipped; only the structure is drawn.

Three dialects

PostgreSQL (schemas, CREATE TYPE … AS ENUM, COMMENT ON, identity columns), MySQL (backticks, AUTO_INCREMENT, inline ENUM, ENGINE options) and SQLite.

Relationships with cardinality

Foreign keys declared inline, as table constraints or with ALTER TABLE. A foreign key on a unique column is shown as 1:1, and join tables as N:M.

Four views

Documentation for non-technical readers, ER diagram for architecture, relationships map and a searchable tree with columns, indexes and constraints.

Your SQL stays in the browser

The SQL is parsed in your browser to draw the diagram. No database connection is needed, and no credentials are asked for.

Tolerant parser

Statements it does not understand are skipped and listed as notices instead of stopping the diagram.

How to Turn SQL into an ER Diagram

Four steps from a SQL file to documentation you can share

01

Get your schema SQL

Use your migration files or export the structure from your database

  • ▸PostgreSQL: pg_dump --schema-only
  • ▸MySQL: mysqldump --no-data
  • ▸SQLite: the .schema command
02

Paste it or upload the file

The diagram updates while you type

  • ▸Accepts .sql files
  • ▸Data and functions in the dump are skipped
  • ▸Check the notices to see what was skipped
03

Pick the view you need

Each view answers a different question

  • ▸ER Diagram: columns, keys and cardinalities
  • ▸Documentation: tables and relationships in plain language
  • ▸Tree View: indexes, constraints and enums
04

Export and share

Take the result to wherever your team works

  • ▸PDF for formal documentation
  • ▸Image for wikis, tickets and pull requests
  • ▸Custom title on the PDF cover

Frequently Asked Questions

About turning SQL into ER diagrams