SQL to ER diagram (CREATE TABLE to ERD)
Paste the CREATE TABLE statements on the left. The tables, keys and links show up in the diagram next to them, and the SQL never leaves your browser.
How to useFrom CREATE TABLE to diagram
SQL to ER diagram (CREATE TABLE to ERD): what it is for
Paste the CREATE TABLE statements of your database and get the entity relationship diagram with the tables, columns, types, primary, foreign and unique keys, and the one to many links taken from the foreign keys.
The SQL is read in your browser; nothing is sent to a server. Download as PNG or SVG, or copy the generated Mermaid code to adjust by hand.
How to use
- Paste the CREATE TABLE statements.
- Check the tables and links in the diagram.
- Download as PNG or SVG or copy the code.
When to use it
- Documenting an existing database.
- Understanding the database of a system new to the team.
- Reviewing foreign keys.
Frequently asked questions
Which databases work?
The reader understands the usual CREATE TABLE of MySQL, MariaDB, PostgreSQL, SQLite and SQL Server: columns with a type, PRIMARY KEY, UNIQUE, REFERENCES on the column and FOREIGN KEY ... REFERENCES at the end of the table. Indexes, CHECK and other options are ignored.
How does it find the links?
From the foreign keys. Each REFERENCES becomes a one to many link between the referenced table and the one that holds the key. A column without a declared foreign key does not create a link, even if the name suggests one.
Can I export and adjust the diagram?
Yes. Download it as PNG or SVG, or copy the generated Mermaid code and paste it into the ER diagram tool to change names, cardinalities and labels by hand.
Is it really free?
Yes, 100% free. No sign-up, no subscription and no usage limits. All Tools123 tools are free and run right in your browser.