DDL to ER Diagram & DB Docs

Paste CREATE TABLE statements or load files to get an ER diagram with the relations drawn as lines, and table definitions listing each column with its type, NULL, default, key and comment. It reads the common syntax of MySQL, PostgreSQL, SQLite, SQL Server and Oracle, and SQLite .db files too.

On-device・No uploadMobile friendlyWorks offlineBeta

Your files and input are processed only inside your browser on this device and are never uploaded to our servers.

CREATE statements

Drop SQL files or a .db here

or

.sql, .txt, or .db (SQLite). You can load several files at once.Accepts: SQL, text, SQLite (.db)Up to 50 MB per file

Paste CREATE TABLE and ALTER TABLE statements, with no file boundaries needed.

ER diagram

No tables yet. Type CREATE TABLE statements or try the sample.

How to use

  1. schema.sql3 tables

    Add CREATE TABLE statements

  2. ER diagramlines between tables

    Link tables by foreign keys

  3. definitions.xlsxalso SVG, PNG, Mermaid

    Export the definition document

Turn CREATE TABLE statements into an ER diagram and a table definition, then export
  1. Press “Try the sample”, or paste CREATE TABLE statements into the box. You can also drop files (.sql, .txt, .db).

  2. Leave the dialect on Auto-detect; most input reads fine. If something is missed, pick MySQL, PostgreSQL or another dialect.

  3. On the ER diagram tab, check the relation lines. Drag a table to move it, or use the arrow keys.

  4. Check the columns on the Table definitions tab, and the lines that could not be read (with line numbers) on the Parse results tab.

  5. Under Export, save the diagram as SVG, PNG (scale ×1 to ×3) or Mermaid (.mmd), and the definitions as HTML, Markdown, CSV or Excel (one sheet per table).

What it does

ER diagram with foreign-key lines

Reads foreign keys written inline, as table constraints, or with ALTER TABLE ADD CONSTRAINT. Relation lines show one-to-many or one-to-one, and whether the parent side is required or optional.

Comments as logical names

Reads column and table comments from MySQL COMMENT clauses, PostgreSQL COMMENT ON, and SQL Server sp_addextendedproperty descriptions, and uses them in the headings and the column descriptions.

Five dialects

Reads the common CREATE TABLE, CREATE INDEX and ALTER TABLE syntax of MySQL, MariaDB, PostgreSQL, SQLite, SQL Server ([brackets] and GO separators) and Oracle. Works without choosing a dialect; [bracket] names are read as SQL Server syntax.

Unreadable statements listed by line

Statements that cannot be read, and tables that point at a table not in the input, are listed with their line and the reason. Everything read still becomes a diagram and definitions. An unclosed quote or comment stops reading at its line, and that line is listed.

Excel cells are never formulas

In the Excel and CSV exports, a value that starts with =, + or - gets a leading apostrophe, so spreadsheet apps show it as text instead of running it.

Use cases

  • Make an ER diagram for a design document from existing DDL quickly
  • Skip building a table definition spreadsheet by hand: type, NULL, default and comment per column
  • Document the structure of a SQLite .db file for a handover
  • Turn DDL into Mermaid code to paste an ER diagram into GitHub or Notion
  • Draw a confidential schema without sending it to an outside service

Supported formats

Input

CREATE TABLE, CREATE INDEX, ALTER TABLE and COMMENT ON statements (text, pasted).sql, .txt or .ddl text (several files at once)SQLite databases (.db, .sqlite)

Output

ER diagram: SVG, PNG, Mermaid (.mmd)Table definitions: HTML, Markdown, CSV, Excel (one sheet per table)

Capability matrix

FeatureSupportNotes
Reading CREATE TABLE, CREATE INDEX, ALTER TABLE ADD (foreign, primary and unique keys) and COMMENTSupported—
Automatic diagram placement, dragging, SVG, PNG and Mermaid exportSupported—
Table definition export as HTML, Markdown, CSV and ExcelSupported—
Connecting to a live databaseNot supportedNo connection is made. Only the definitions (DDL text or the structure of a .db file) are read
Analysing stored procedures, views, triggers and functionsNot supportedThey are left in the parse results. View columns are not guessed
Applying ALTER TABLE changes other than ADD (DROP, MODIFY, RENAME, ALTER COLUMN and so on)PartialOnly ADD (columns, constraints, foreign keys) is applied. Other changes stay in the parse results
Reading data (the contents of INSERT statements)Not supportedOnly table definitions are handled

Limits & notes

  • Input is limited to 3 million characters in total and 200 tables.
  • A .db file is limited to 50 MB. Encrypted databases cannot be opened.
  • Relation lines are drawn only when the referenced table is in the same input.
  • The dialect is detected from the text. Where the same syntax means different things in two dialects, choose the dialect yourself.
  • SVG and PNG text is drawn with the fonts on your device. PNG is limited to 8,192 px on the longest side and 32 million pixels.

Privacy & safety

Reading the SQL, drawing the diagram and exporting all happen in your browser. Neither files nor DDL are sent to or stored on a server. SQLite files are read in the browser too.

FAQ

How do I make an ER diagram from CREATE TABLE statements?
Paste the CREATE TABLE statements into the box, or drop a .sql file. Foreign keys (REFERENCES, FOREIGN KEY, or ALTER TABLE ADD CONSTRAINT) are drawn as lines between the tables.
Can I export the table definitions to Excel?
Yes. Save as Excel to get an .xlsx with a summary sheet, a relations sheet, and one sheet per table. HTML, Markdown and CSV are also available.
What happens to statements that cannot be read?
Each one is listed with its line number under Parse results, and it is left out of the diagram and the definitions. Reading then continues. The exception is an unclosed quote or comment: reading stops at that line, and the lines after it are not read.
Are MySQL COMMENT clauses and PostgreSQL COMMENT ON used?
Yes. Column and table comments are used in the description column and the headings. SQL Server sp_addextendedproperty descriptions are read too.
Can it connect to a database and read it?
No. It does not connect to a live database. It reads the structure from DDL text or from a SQLite .db file.
Is it safe to paste an internal schema?
The DDL is processed only in your browser and never sent to a server. Closing the page clears the input, so save any output you need.

SQL Studio — Format, Analyze & Convert

Paste SQL to format, minify or analyze it for your dialect. Strings and comments are never altered, UPDATE/DELETE without WHERE and DROP are flagged, and value lists or CSV rows become IN clauses and INSERT statements — all on your device.

No uploadBeta

SQLite Viewer & Query Playground

Drop a .sqlite or .db file to list its tables, views, indexes and triggers and browse rows with paging, sorting and filtering. Run multi-statement SQL in the editor, export results as CSV, Excel or JSON, and save the changed database as .sqlite. Your files never leave your device.

No uploadBeta

Mermaid Studio

Write Mermaid code on the left and the diagram appears on the right. Start from a flowchart, sequence, class or ER template and save SVG or PNG with the scale and background you choose. Rendering happens in your browser; your code is never sent.

No uploadBeta

Dummy Data Generator

Build fictional test data for demos and development. Pick a type per column and export to CSV, TSV, JSON, JSON Lines, SQL INSERT or Excel. Names, addresses and companies are made-up combinations, and emails use only example domains.

No uploadBeta

CSV Encoding Fix

Convert CSV files that show garbled text in Excel to UTF-8 with BOM or Shift_JIS, with automatic encoding detection. Mojibake that was already saved, such as “日本語”, can usually be restored too.

No upload

CSV Studio

Open CSV files that are slow or garbled in Excel and view, search and edit them right away in your browser. Combine, split and save as CSV (UTF-8 with BOM, Shift_JIS), Excel or JSON on one screen.

No upload

Last updated: