DEVELOPER TOOLS
SQL Schema Diagram Generator
Turn CREATE TABLE statements into a visual entity-relationship diagram, with keys, foreign-key links, and Mermaid export.
LOCAL DDL PARSER
Build an ER diagram
Paste table definitions. This page parses the schema text only: it does not connect to or execute SQL against a database.
Supports common CREATE TABLE definitions, quoted identifiers, inline or table-level primary/foreign keys, and multiple statements. Review the documented parser limits below; vendor-specific DDL may need simplifying.
Entity relationship diagram
Review these diagnostics
Export the diagram
The SVG is a standalone vector diagram. Mermaid text is useful in compatible documentation and code-review tools.
Parsing and diagram generation happen in your browser. SQL text and schema names are not uploaded.
SQL schema diagram generator guide
An entity-relationship diagram turns table definitions and foreign keys into a picture that is easier to discuss than a long migration file. Paste common CREATE TABLE statements to see tables, columns, primary keys, and recognized foreign-key relationships, then export the result as SVG or Mermaid text.
The generator parses DDL text; it never connects to a database or runs a statement. Its purpose is to help review a schema, not to reverse-engineer a live database or replace a database vendor’s full SQL parser.
Describe the schema with CREATE TABLE
Paste one or more table definitions, including the columns and keys you want to show. Inline primary keys and references are supported, as are table-level primary-key and foreign-key constraints. Quoted identifiers and common types such as VARCHAR(80) or DECIMAL(8,2) help retain the names and shapes that matter in the diagram.
Comments, nested type parentheses, and commas inside quoted default strings are handled while the input is split into table fields. Other vendor-specific statements—such as indexes, triggers, views, procedures, and arbitrary migration commands—are not executed and may be ignored or require simplifying the DDL to its table definitions.
Follow keys and interpret diagnostics
Primary-key markers identify the columns that make a row addressable; foreign-key markers and connector arrows show relationships that can be resolved inside the pasted set of tables. A composite key or relationship can involve several columns. Missing target tables and duplicate names are reported so you can decide whether the paste is incomplete or the schema needs correction.
The parser infers relationships only from recognized key declarations. A naming convention such as customer_id does not prove a foreign key, and a clean diagram cannot confirm that a real database has the same constraints. Compare the generated map with migrations or a trusted schema export before relying on it.
Export and share the right representation
Download the SVG when you need a self-contained visual for documentation, or copy Mermaid source for a repository or editor that supports Mermaid ER diagrams. Large diagrams may be easier to read after splitting unrelated tables into smaller groups; the page limits the input size and number of displayed tables to keep rendering responsive.
Only table names, column names, types, and recognized key relationships are used in the diagram; default values and SQL statements are not included in the export. Processing stays in your browser. Review the diagram before sharing it, since schema names can still reveal internal product structure.
Frequently asked questions
Does the tool connect to my database?
No. It parses pasted CREATE TABLE statements locally and never connects to or executes SQL against a database.
Which SQL statements are supported?
The diagram is built from common CREATE TABLE definitions with columns and recognized primary or foreign keys. It is not a complete parser for every SQL dialect or migration statement.
Why is a relationship missing?
The parser needs an explicit inline REFERENCES clause or table-level FOREIGN KEY constraint, and the referenced table must be included in the pasted schema.
Can I use the SVG in documentation?
Yes. Download the generated SVG for a vector image, or copy Mermaid text into a compatible documentation tool. Check a large diagram at the intended display size.
Privacy note: this tool processes your data in your browser. Your inputs and files are not submitted to NAB Tools.