EN
PortuguêsEnglishEspañol
All tools
Documents 100% free

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 use

Thank you so much for helping!

Every donation helps pay for the servers and keeps the tools free for everyone. Pick or type an amount:

Secure payment by Stripe. Opens in a new tab.

Back to Documents

From CREATE TABLE to diagram

Available in: PortuguêsEspañolEnglish

Advertisement

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

  1. Paste the CREATE TABLE statements.
  2. Check the tables and links in the diagram.
  3. 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.

Similar tools

The tools are provided as is, without warranty. We are not responsible for the results or for how they are used.