SQL DDL to ER Diagram

Turn supported CREATE TABLE declarations into a reviewable relationship diagram and Mermaid source.

Inputs stay on your device No sign-up Free to use
How this works

The tool runs in this browser. Your file or text is not uploaded to UseFreeTools. Check this tool's limits for anything it may save on your device.

Privacy details

Inspect input controls

Showing an example. Edit to see your own.

A strict PostgreSQL-like subset: 100,000 UTF-8 bytes, 12 tables, 120 columns and 40 declared foreign keys.

Processed in your browser. Your inputs stay on this device.

How to use SQL DDL to ER Diagram

  1. Paste supported CREATE TABLE statements.
  2. Generate the diagram and inspect declared columns and keys.
  3. Download the SVG and Mermaid source, then check them against your database design.

Example: SQL DDL to ER Diagram

CREATE TABLE people (id INTEGER PRIMARY KEY, name TEXT);

You add
CREATE TABLE declarations: CREATE TABLE customers (id INTEGER PRIMARY KEY, name VARCHAR(100) NOT NULL); CREATE TABLE orders (id INTEGER PRIMARY KEY, customer_id INTEGER REFERENCES customers(id), total DECIMAL(10,2));
You get
Diagrammed 2 tables and 1 declared foreign keys. Sample rows: orders | customer_id | customers | id.

Options

Table declarations
Enter supported CREATE TABLE statements with explicit columns and keys. Unsupported statements or dialect syntax need review before they can be represented.
Relationships
Edges come from declared foreign keys. The diagram does not infer relationships from similarly named columns or guess data cardinality.

Supported inputs and limits

A conservative CREATE TABLE subset only. Declared columns, primary/unique keys and foreign keys are inspected; unsupported SQL is refused. Diagram relationships come from explicit foreign keys and do not infer data cardinality. No SQL execution, database connection or complete dialect parser. Input up to 100,000 bytes, 12 tables, 120 columns, 40 foreign keys and 12,000 tokens. Mermaid uses class-diagram syntax with generated identifiers and a separate original-name map; the SVG shows original names. No inferred cardinalities.

Where your input is processed

This tool processes your input in this browser. Your text and files are not uploaded to UseFreeTools. Check this tool's limits for anything it may save on your device.

Keep original names with the diagram

The SVG displays original names, while Mermaid uses generated identifiers and a separate name map. Include that mapping when adapting the Mermaid source. A relationship picture can help review a schema draft, but it does not run migrations, inspect existing data or prove that a database currently enforces the constraints.

Questions about SQL DDL to ER Diagram

Does this run the SQL?

No. It reads supported declarations in the browser.

Are all database dialects supported?

No. Unsupported types, constraints or statement forms are refused.

Where do the relationship lines come from?

Only declared foreign keys create relationships; the tool does not infer row counts or business rules.

Project manager: Tony Hines · Content updated 4 October 2026 · Report a problem