{"id":2696,"date":"2023-02-28T08:00:04","date_gmt":"2023-02-28T13:00:04","guid":{"rendered":"https:\/\/www.dpriver.com\/blog\/?p=2696"},"modified":"2026-09-01T18:23:36","modified_gmt":"2026-09-01T10:23:36","slug":"convert-sql-into-e-r-diagram-with-sqlflow","status":"publish","type":"post","link":"https:\/\/www.dpriver.com\/blog\/convert-sql-into-e-r-diagram-with-sqlflow\/","title":{"rendered":"Convert SQL to ER Diagram Online \u2014 Free ERD Generator"},"content":{"rendered":"<p>Need to turn a SQL script into an ER diagram (ERD)? Paste your SQL \u2014 CREATE TABLE \/ ALTER TABLE statements with foreign keys \u2014 and get an entity-relationship diagram in seconds.<\/p>\n<p><strong><a href=\"https:\/\/sqlflow.gudusoft.com\/?utm_source=dpriverBlog&#038;utm_medium=link&#038;utm_campaign=erd_refresh&#038;utm_content=try-erd-top\">Try it now \u2014 paste your SQL into Gudu SQLFlow and click the ER-model icon (free)<\/a><\/strong><\/p>\n<p><a href=\"http:\/\/sqlflow.gudusoft.com\/#\/\" target=\"_blank\" rel=\"noreferrer noopener\">SQLFlow<\/a> is capable to convert <strong>SQL to Entity-Relation(ER) Diagram<\/strong> as well as to visualize the relations between tables and fields so that you can quickly understand the design model of the database and conduct efficient team communication. <\/p>\n<h2 class=\"wp-block-heading\">Two Sources of Visualization ER Model<a href=\"https:\/\/docs.gudusoft.com\/\"><\/a><\/h2>\n<ul>\n<li><strong>From SQL Script<\/strong><\/li>\n<\/ul>\n<p>SQLFlow can analyze Database creation SQL script and visualize the provided scripts. In order to create ER diagram, user need to provide SQL statements such as <code>create table<\/code> or <code>alter table<\/code> and include foreign keys.<\/p>\n<ul>\n<li><strong>From Database<\/strong><\/li>\n<\/ul>\n<p>You can simply make SQLFlow connect to your database for the ER diagram. SQLFlow will automatically retrieve metadata from the database and generate the ER diagram.<\/p>\n<h2 class=\"wp-block-heading\">Three Ways to Visualize ER Model<\/h2>\n<p>Let&#8217;s now take a look on how exactly to use <a href=\"https:\/\/sqlflow.gudusoft.com\/#\/\" target=\"_blank\" rel=\"noreferrer noopener\">Gudu SQLFlow<\/a>.<\/p>\n<p><a href=\"https:\/\/sqlflow.gudusoft.com\/#\/\" target=\"_blank\" rel=\"noreferrer noopener\">Gudu SQLFlow<\/a> provides three ways:<\/p>\n<h4 class=\"wp-block-heading\">1. Paste SQL Statements into the SQLText Editor<a href=\"https:\/\/docs.gudusoft.com\/\"><\/a><\/h4>\n<p>Directly paste your SQL statements into the SQLText Editor<\/p>\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"669\" height=\"619\" src=\"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/image.png\" alt=\"\" class=\"wp-image-2700\" srcset=\"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/image.png 669w, https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/image-300x278.png 300w\" sizes=\"(max-width: 669px) 100vw, 669px\" \/><\/figure>\n<p>Click the icon of the ER model and you will have the correspond ER diagram instantly.<\/p>\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"657\" height=\"189\" src=\"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/image-1.png\" alt=\"\" class=\"wp-image-2701\" srcset=\"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/image-1.png 657w, https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/image-1-300x86.png 300w\" sizes=\"(max-width: 657px) 100vw, 657px\" \/><\/figure>\n<p>Result:<\/p>\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1009\" height=\"1024\" src=\"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/12\/\u5fae\u4fe1\u622a\u56fe_20231218225252-1009x1024.png\" alt=\"\" class=\"wp-image-2987\" srcset=\"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/12\/\u5fae\u4fe1\u622a\u56fe_20231218225252-1009x1024.png 1009w, https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/12\/\u5fae\u4fe1\u622a\u56fe_20231218225252-296x300.png 296w, https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/12\/\u5fae\u4fe1\u622a\u56fe_20231218225252-768x779.png 768w, https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/12\/\u5fae\u4fe1\u622a\u56fe_20231218225252.png 1181w\" sizes=\"(max-width: 1009px) 100vw, 1009px\" \/><\/figure>\n<h4 class=\"wp-block-heading\">2. Upload SQL files<\/h4>\n<p>Click <code>upload sql<\/code><\/p>\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"665\" height=\"184\" src=\"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/image-2.png\" alt=\"\" class=\"wp-image-2702\" srcset=\"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/image-2.png 665w, https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/image-2-300x83.png 300w\" sizes=\"(max-width: 665px) 100vw, 665px\" \/><\/figure>\n<p>Choose <code>upload file<\/code> as the job source and choose the SQL type in the <code>dbvendor<\/code>. Upload file and create the Job.<\/p>\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"599\" height=\"466\" src=\"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/image-3.png\" alt=\"\" class=\"wp-image-2703\" srcset=\"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/image-3.png 599w, https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/image-3-300x233.png 300w\" sizes=\"(max-width: 599px) 100vw, 599px\" \/><\/figure>\n<p>Choose the job in the job list panel when it is complete.<\/p>\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"392\" height=\"605\" src=\"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/image-4.png\" alt=\"\" class=\"wp-image-2704\" srcset=\"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/image-4.png 392w, https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/image-4-194x300.png 194w\" sizes=\"(max-width: 392px) 100vw, 392px\" \/><\/figure>\n<p>Click <code>show ER diagram<\/code> in the schema explorer and check the result.<\/p>\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"389\" height=\"299\" src=\"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/image-5.png\" alt=\"\" class=\"wp-image-2705\" srcset=\"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/image-5.png 389w, https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/image-5-300x231.png 300w\" sizes=\"(max-width: 389px) 100vw, 389px\" \/><\/figure>\n<p>Result:<\/p>\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"584\" src=\"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/12\/\u5fae\u4fe1\u622a\u56fe_20231210165309-1024x584.png\" alt=\"\" class=\"wp-image-2942\" srcset=\"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/12\/\u5fae\u4fe1\u622a\u56fe_20231210165309-1024x584.png 1024w, https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/12\/\u5fae\u4fe1\u622a\u56fe_20231210165309-300x171.png 300w, https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/12\/\u5fae\u4fe1\u622a\u56fe_20231210165309-768x438.png 768w, https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/12\/\u5fae\u4fe1\u622a\u56fe_20231210165309.png 1321w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<h4 class=\"wp-block-heading\">3. Connect to DB<\/h4>\n<p>Connect to your database for the ER diagram, check following table for the supported database types and the permissions\/roles needed:<\/p>\n<figure class=\"wp-block-table\">\n<table>\n<tbody>\n<tr>\n<td><strong>Database Type<\/strong><\/td>\n<td><strong>Permissions\/Roles required<\/strong><\/td>\n<td><strong>Comment<\/strong><\/td>\n<\/tr>\n<tr>\n<td>MySQL<\/td>\n<td>SELECT<\/td>\n<td>ER Diagram needs DB user to have SELECT permission<\/td>\n<\/tr>\n<tr>\n<td>PostgreSQL<\/td>\n<td>SELECT<\/td>\n<td>ER Diagram needs DB user to have SELECT permission<\/td>\n<\/tr>\n<tr>\n<td>SQL Server<\/td>\n<td>SELECT<\/td>\n<td>ER Diagram needs DB user to have SELECT permission<\/td>\n<\/tr>\n<tr>\n<td>Oracle<\/td>\n<td>DBA<\/td>\n<td>To generate ER Diagram from Oracle database, input user must has DBA role , otherwise <code>ORA-01031<\/code> will be returned.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<p><em>Hint: Other databases are not in current version&#8217;s support list and will be supported in our future release<\/em><\/p>\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"592\" height=\"515\" src=\"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-11.png\" alt=\"\" class=\"wp-image-2707\" srcset=\"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-11.png 592w, https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-11-300x261.png 300w\" sizes=\"(max-width: 592px) 100vw, 592px\" \/><\/figure>\n<p>Choose the job in the job list panel when it is complete.<\/p>\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"392\" height=\"605\" src=\"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-12.png\" alt=\"\" class=\"wp-image-2708\" srcset=\"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-12.png 392w, https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-12-194x300.png 194w\" sizes=\"(max-width: 392px) 100vw, 392px\" \/><\/figure>\n<p>Click <code>show ER diagram<\/code> in the schema explorer and check the result.<\/p>\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"389\" height=\"299\" src=\"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-13.png\" alt=\"\" class=\"wp-image-2709\" srcset=\"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-13.png 389w, https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-13-300x231.png 300w\" sizes=\"(max-width: 389px) 100vw, 389px\" \/><\/figure>\n<h2 class=\"wp-block-heading\">E-R Diagram<\/h2>\n<p>The following capture is the ER diagram of <a href=\"https:\/\/github.com\/pthom\/northwind\\_psql\" target=\"_blank\" rel=\"noreferrer noopener\">Northwind database<\/a> generated by <a href=\"https:\/\/sqlflow.gudusoft.com\/#\/\" target=\"_blank\" rel=\"noreferrer noopener\">Gudu SQLFlow<\/a>. We will have tables, fields, field types and different kinds of key which are under different icons in the diagram.<\/p>\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"837\" height=\"1024\" src=\"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-14-837x1024.png\" alt=\"\" class=\"wp-image-2710\" srcset=\"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-14-837x1024.png 837w, https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-14-245x300.png 245w, https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-14-768x940.png 768w, https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-14.png 1072w\" sizes=\"(max-width: 837px) 100vw, 837px\" \/><\/figure>\n<p>The following ER diagram is a simple <a href=\"https:\/\/github.com\/thekordy\/ticketit\" target=\"_blank\" rel=\"noreferrer noopener\">help-desk tickets system<\/a> generate by <a href=\"https:\/\/sqlflow.gudusoft.com\/#\/\" target=\"_blank\" rel=\"noreferrer noopener\">Gudu SQLFlow<\/a> from the <a href=\"https:\/\/e.gitee.com\/gudusoft\/repos\/gudusoft\/sqldepot\/blob\/master\/sql2er\/drawsql\/ticketit.sql\" target=\"_blank\" rel=\"noreferrer noopener\">SQL file<\/a>.<\/p>\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"855\" height=\"586\" src=\"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-18.png\" alt=\"\" class=\"wp-image-2717\" srcset=\"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-18.png 855w, https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-18-300x206.png 300w, https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-18-768x526.png 768w\" sizes=\"(max-width: 855px) 100vw, 855px\" \/><\/figure>\n<h2 class=\"wp-block-heading\">SQL Requirements to Create ER Diagram<\/h2>\n<p>In order to create ER diagram, foreign keys should be included in the provided SQL files. Other keys such as primary key, index key or unique key are not mandatory.<\/p>\n<h4 class=\"wp-block-heading\">A. Foreign key<\/h4>\n<p>Foreign key is to build ER relations between different tables. Statements such as <code>create table<\/code> and <code>alter table<\/code> usually contain this information.<\/p>\n<p><strong>1. Foreign key in create table<\/strong><\/p>\n<pre class=\"wp-block-code\"><code>CREATE TABLE SCOTT.EMP \n   (\t\n\tEMPNO NUMBER(4,0), \n\tENAME VARCHAR2(10), \n\tDEPTNO NUMBER(2,0), \n\tCONSTRAINT PK_EMP PRIMARY KEY (EMPNO),\n\tFOREIGN KEY(DEPTNO) REFERENCES SCOTT.DEPT(DEPTNO)\n   );<\/code><\/pre>\n<p><strong>2. Foreign key in alter table<\/strong><\/p>\n<pre class=\"wp-block-code\"><code>ALTER TABLE SCOTT.EMP ADD CONSTRAINT FK_DEPTNO FOREIGN KEY (\"DEPTNO\")\n\t  REFERENCES SCOTT.DEPT (\"DEPTNO\") ENABLE;<\/code><\/pre>\n<h4 class=\"wp-block-heading\">B. Primary key, index key, unique key<\/h4>\n<p><strong>1. Primary key<a href=\"https:\/\/docs.gudusoft.com\/1.-introduction\/getting-started\/convert-sql-to-e-r-diagram#1.-primary-key\"><\/a><\/strong><\/p>\n<p>Primary key can be specified in <code>create table<\/code> and <code>alter table<\/code> statement.<\/p>\n<pre class=\"wp-block-code\"><code>CREATE TABLE SCOTT.EMP \n   (\t\n\tEMPNO NUMBER(4,0), \n\tENAME VARCHAR2(10), \n\tDEPTNO NUMBER(2,0), \n\tCONSTRAINT PK_EMP PRIMARY KEY (EMPNO),\n\tFOREIGN KEY(DEPTNO) REFERENCES SCOTT.DEPT(DEPTNO)\n   );<\/code><\/pre>\n<pre class=\"wp-block-code\"><code>ALTER TABLE SCOTT.DEPT\nADD CONSTRAINT dept_pk PRIMARY KEY (DEPTNO);<\/code><\/pre>\n<p>Icon of <strong>primary key in ER diagram<\/strong><\/p>\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"215\" height=\"28\" src=\"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-15.png\" alt=\"\" class=\"wp-image-2711\"\/><\/figure>\n<p><strong>2. Unique key<\/strong><\/p>\n<p>Unique key can be specified in <code>create table<\/code> and <code>alter table<\/code> statement.<\/p>\n<pre class=\"wp-block-code\"><code>CREATE TABLE SCOTT.DEPT \n   (\n    DEPTNO NUMBER(2,0), \n\tDNAME VARCHAR2(14), \n\tLOC VARCHAR2(13),\n\tCONSTRAINT constraint_name UNIQUE (DEPTNO)\n   ) ;<\/code><\/pre>\n<pre class=\"wp-block-code\"><code>ALTER TABLE SCOTT.DEPT \nADD CONSTRAINT constraint_name UNIQUE (DEPTNO);  <\/code><\/pre>\n<p>Icon of<strong> unique key in ER diagram<\/strong><\/p>\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"209\" height=\"29\" src=\"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-16.png\" alt=\"\" class=\"wp-image-2712\"\/><\/figure>\n<p><strong>3. Index key<\/strong><\/p>\n<p>Index key can be specified using <code>create index<\/code> statement.<\/p>\n<pre class=\"wp-block-code\"><code>-- Oracle\nCREATE INDEX SCOTT.DEPT_INDEX \nON SCOTT.DEPT (LOC);<\/code><\/pre>\n<p>Or alter table add index<\/p>\n<pre class=\"wp-block-code\"><code>-- MySQL\nALTER TABLE\n    `ticketit` ADD INDEX `ticketit_subject_index`(`subject`);<\/code><\/pre>\n<p>Icon of <strong>index key in ER diagram<\/strong><\/p>\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"209\" height=\"30\" src=\"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-17.png\" alt=\"\" class=\"wp-image-2713\"\/><\/figure>\n<\/p>\n<p>key word: erd generator from sql, sql code to er diagram, sql to erd, generate er diagram from sql online, sql to er diagram online, sql to er diagram<\/p>\n<h2>FAQ: SQL to ER Diagram<\/h2>\n<h3>How do I convert SQL to an ER diagram online?<\/h3>\n<p>Paste your SQL script (CREATE TABLE and ALTER TABLE statements with foreign keys) into Gudu SQLFlow&#8217;s editor and click the ER-model icon. The entity-relationship diagram is generated instantly in your browser \u2014 no database connection required.<\/p>\n<h3>Can I generate an ERD from just a CREATE TABLE script?<\/h3>\n<p>Yes. SQLFlow analyzes the DDL itself: tables, columns, primary keys, and foreign-key constraints become entities and relationships. If your script has no explicit foreign keys, add ALTER TABLE &#8230; ADD FOREIGN KEY statements so the relationships can be drawn.<\/p>\n<h3>Is the SQL to ER diagram tool free?<\/h3>\n<p>Yes \u2014 pasting SQL and generating the ER diagram in Gudu SQLFlow Cloud is free. Connecting directly to a live database for automatic metadata retrieval is part of the premium and on-premises editions.<\/p>\n<h3>Which databases are supported?<\/h3>\n<p>All major dialects, including SQL Server, Oracle, MySQL, PostgreSQL, Snowflake, BigQuery, Redshift, Teradata, Hive and more than 20 others \u2014 the same engine that powers the Instant SQL Formatter.<\/p>\n<p><script type=\"application\/ld+json\">{\"@context\": \"https:\/\/schema.org\", \"@type\": \"FAQPage\", \"mainEntity\": [{\"@type\": \"Question\", \"name\": \"How do I convert SQL to an ER diagram online?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Paste your SQL script (CREATE TABLE and ALTER TABLE statements with foreign keys) into Gudu SQLFlow's editor and click the ER-model icon. The entity-relationship diagram is generated instantly in your browser \\u2014 no database connection required.\"}}, {\"@type\": \"Question\", \"name\": \"Can I generate an ERD from just a CREATE TABLE script?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Yes. SQLFlow analyzes the DDL itself: tables, columns, primary keys, and foreign-key constraints become entities and relationships. If your script has no explicit foreign keys, add ALTER TABLE ... ADD FOREIGN KEY statements so the relationships can be drawn.\"}}, {\"@type\": \"Question\", \"name\": \"Is the SQL to ER diagram tool free?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Yes \\u2014 pasting SQL and generating the ER diagram in Gudu SQLFlow Cloud is free. Connecting directly to a live database for automatic metadata retrieval is part of the premium and on-premises editions.\"}}, {\"@type\": \"Question\", \"name\": \"Which databases are supported?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"All major dialects, including SQL Server, Oracle, MySQL, PostgreSQL, Snowflake, BigQuery, Redshift, Teradata, Hive and more than 20 others \\u2014 the same engine that powers the Instant SQL Formatter.\"}}]}<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Need to turn a SQL script into an ER diagram (ERD)? Paste your SQL \u2014 CREATE TABLE \/ ALTER TABLE statements with foreign keys \u2014 and get an entity-relationship diagram in seconds. Try it now \u2014 paste your SQL into Gudu SQLFlow and click the ER-model icon (free) SQLFlow is capable to convert SQL to Entity-Relation(ER) Diagram as well as to visualize the relations between tables and fields so that you can quickly understand the design model of the database and conduct efficient team communication. Two Sources of Visualization ER Model From SQL Script SQLFlow can analyze Database creation SQL\u2026<\/p>\n","protected":false},"author":6,"featured_media":2710,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[66,93],"tags":[],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":5}},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v19.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Convert SQL to ER Diagram Online \u2014 Free ERD Generator | SQLFlow<\/title>\n<meta name=\"description\" content=\"Paste CREATE TABLE scripts and get an ER diagram online in seconds. Free SQL to ERD generator for SQL Server, Oracle, MySQL, PostgreSQL, Snowflake and 20+ more.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dpriver.com\/blog\/convert-sql-into-e-r-diagram-with-sqlflow\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Convert SQL to ER Diagram Online \u2014 Free ERD Generator | SQLFlow\" \/>\n<meta property=\"og:description\" content=\"Paste CREATE TABLE scripts and get an ER diagram online in seconds. Free SQL to ERD generator for SQL Server, Oracle, MySQL, PostgreSQL, Snowflake and 20+ more.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dpriver.com\/blog\/convert-sql-into-e-r-diagram-with-sqlflow\/\" \/>\n<meta property=\"og:site_name\" content=\"SQL and Data Blog\" \/>\n<meta property=\"article:published_time\" content=\"2023-02-28T13:00:04+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-09-01T10:23:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-14.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1072\" \/>\n\t<meta property=\"og:image:height\" content=\"1312\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"leo gu\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"leo gu\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.dpriver.com\/blog\/#organization\",\"name\":\"SQL and Data Blog\",\"url\":\"https:\/\/www.dpriver.com\/blog\/\",\"sameAs\":[],\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.dpriver.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2022\/07\/sqlpp-character.png\",\"contentUrl\":\"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2022\/07\/sqlpp-character.png\",\"width\":251,\"height\":72,\"caption\":\"SQL and Data Blog\"},\"image\":{\"@id\":\"https:\/\/www.dpriver.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dpriver.com\/blog\/#website\",\"url\":\"https:\/\/www.dpriver.com\/blog\/\",\"name\":\"SQL and Data Blog\",\"description\":\"SQL related blog for database professional\",\"publisher\":{\"@id\":\"https:\/\/www.dpriver.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dpriver.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dpriver.com\/blog\/convert-sql-into-e-r-diagram-with-sqlflow\/\",\"url\":\"https:\/\/www.dpriver.com\/blog\/convert-sql-into-e-r-diagram-with-sqlflow\/\",\"name\":\"Convert SQL to ER Diagram Online \u2014 Free ERD Generator | SQLFlow\",\"isPartOf\":{\"@id\":\"https:\/\/www.dpriver.com\/blog\/#website\"},\"datePublished\":\"2023-02-28T13:00:04+00:00\",\"dateModified\":\"2026-09-01T10:23:36+00:00\",\"description\":\"Paste CREATE TABLE scripts and get an ER diagram online in seconds. Free SQL to ERD generator for SQL Server, Oracle, MySQL, PostgreSQL, Snowflake and 20+ more.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.dpriver.com\/blog\/convert-sql-into-e-r-diagram-with-sqlflow\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dpriver.com\/blog\/convert-sql-into-e-r-diagram-with-sqlflow\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dpriver.com\/blog\/convert-sql-into-e-r-diagram-with-sqlflow\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.dpriver.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Convert SQL to ER Diagram Online \u2014 Free ERD Generator\"}]},{\"@type\":\"Article\",\"@id\":\"https:\/\/www.dpriver.com\/blog\/convert-sql-into-e-r-diagram-with-sqlflow\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dpriver.com\/blog\/convert-sql-into-e-r-diagram-with-sqlflow\/\"},\"author\":{\"name\":\"leo gu\",\"@id\":\"https:\/\/www.dpriver.com\/blog\/#\/schema\/person\/9e80d249b6da4e572bd8590b0789bc14\"},\"headline\":\"Convert SQL to ER Diagram Online \u2014 Free ERD Generator\",\"datePublished\":\"2023-02-28T13:00:04+00:00\",\"dateModified\":\"2026-09-01T10:23:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dpriver.com\/blog\/convert-sql-into-e-r-diagram-with-sqlflow\/\"},\"wordCount\":766,\"publisher\":{\"@id\":\"https:\/\/www.dpriver.com\/blog\/#organization\"},\"articleSection\":[\"Data Governance\",\"SQLFlow\"],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dpriver.com\/blog\/#\/schema\/person\/9e80d249b6da4e572bd8590b0789bc14\",\"name\":\"leo gu\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.dpriver.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/24976e2e4ca7dd476652bb26bd09392b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/24976e2e4ca7dd476652bb26bd09392b?s=96&d=mm&r=g\",\"caption\":\"leo gu\"},\"url\":\"https:\/\/www.dpriver.com\/blog\/author\/guyuanhao\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Convert SQL to ER Diagram Online \u2014 Free ERD Generator | SQLFlow","description":"Paste CREATE TABLE scripts and get an ER diagram online in seconds. Free SQL to ERD generator for SQL Server, Oracle, MySQL, PostgreSQL, Snowflake and 20+ more.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dpriver.com\/blog\/convert-sql-into-e-r-diagram-with-sqlflow\/","og_locale":"en_US","og_type":"article","og_title":"Convert SQL to ER Diagram Online \u2014 Free ERD Generator | SQLFlow","og_description":"Paste CREATE TABLE scripts and get an ER diagram online in seconds. Free SQL to ERD generator for SQL Server, Oracle, MySQL, PostgreSQL, Snowflake and 20+ more.","og_url":"https:\/\/www.dpriver.com\/blog\/convert-sql-into-e-r-diagram-with-sqlflow\/","og_site_name":"SQL and Data Blog","article_published_time":"2023-02-28T13:00:04+00:00","article_modified_time":"2026-09-01T10:23:36+00:00","og_image":[{"width":1072,"height":1312,"url":"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2023\/02\/\u56fe\u7247-14.png","type":"image\/png"}],"author":"leo gu","twitter_card":"summary_large_image","twitter_misc":{"Written by":"leo gu","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Organization","@id":"https:\/\/www.dpriver.com\/blog\/#organization","name":"SQL and Data Blog","url":"https:\/\/www.dpriver.com\/blog\/","sameAs":[],"logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dpriver.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2022\/07\/sqlpp-character.png","contentUrl":"https:\/\/www.dpriver.com\/blog\/wp-content\/uploads\/2022\/07\/sqlpp-character.png","width":251,"height":72,"caption":"SQL and Data Blog"},"image":{"@id":"https:\/\/www.dpriver.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"WebSite","@id":"https:\/\/www.dpriver.com\/blog\/#website","url":"https:\/\/www.dpriver.com\/blog\/","name":"SQL and Data Blog","description":"SQL related blog for database professional","publisher":{"@id":"https:\/\/www.dpriver.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dpriver.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.dpriver.com\/blog\/convert-sql-into-e-r-diagram-with-sqlflow\/","url":"https:\/\/www.dpriver.com\/blog\/convert-sql-into-e-r-diagram-with-sqlflow\/","name":"Convert SQL to ER Diagram Online \u2014 Free ERD Generator | SQLFlow","isPartOf":{"@id":"https:\/\/www.dpriver.com\/blog\/#website"},"datePublished":"2023-02-28T13:00:04+00:00","dateModified":"2026-09-01T10:23:36+00:00","description":"Paste CREATE TABLE scripts and get an ER diagram online in seconds. Free SQL to ERD generator for SQL Server, Oracle, MySQL, PostgreSQL, Snowflake and 20+ more.","breadcrumb":{"@id":"https:\/\/www.dpriver.com\/blog\/convert-sql-into-e-r-diagram-with-sqlflow\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dpriver.com\/blog\/convert-sql-into-e-r-diagram-with-sqlflow\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.dpriver.com\/blog\/convert-sql-into-e-r-diagram-with-sqlflow\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.dpriver.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Convert SQL to ER Diagram Online \u2014 Free ERD Generator"}]},{"@type":"Article","@id":"https:\/\/www.dpriver.com\/blog\/convert-sql-into-e-r-diagram-with-sqlflow\/#article","isPartOf":{"@id":"https:\/\/www.dpriver.com\/blog\/convert-sql-into-e-r-diagram-with-sqlflow\/"},"author":{"name":"leo gu","@id":"https:\/\/www.dpriver.com\/blog\/#\/schema\/person\/9e80d249b6da4e572bd8590b0789bc14"},"headline":"Convert SQL to ER Diagram Online \u2014 Free ERD Generator","datePublished":"2023-02-28T13:00:04+00:00","dateModified":"2026-09-01T10:23:36+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dpriver.com\/blog\/convert-sql-into-e-r-diagram-with-sqlflow\/"},"wordCount":766,"publisher":{"@id":"https:\/\/www.dpriver.com\/blog\/#organization"},"articleSection":["Data Governance","SQLFlow"],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dpriver.com\/blog\/#\/schema\/person\/9e80d249b6da4e572bd8590b0789bc14","name":"leo gu","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dpriver.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/24976e2e4ca7dd476652bb26bd09392b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/24976e2e4ca7dd476652bb26bd09392b?s=96&d=mm&r=g","caption":"leo gu"},"url":"https:\/\/www.dpriver.com\/blog\/author\/guyuanhao\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dpriver.com\/blog\/wp-json\/wp\/v2\/posts\/2696"}],"collection":[{"href":"https:\/\/www.dpriver.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dpriver.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dpriver.com\/blog\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dpriver.com\/blog\/wp-json\/wp\/v2\/comments?post=2696"}],"version-history":[{"count":12,"href":"https:\/\/www.dpriver.com\/blog\/wp-json\/wp\/v2\/posts\/2696\/revisions"}],"predecessor-version":[{"id":3264,"href":"https:\/\/www.dpriver.com\/blog\/wp-json\/wp\/v2\/posts\/2696\/revisions\/3264"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.dpriver.com\/blog\/wp-json\/wp\/v2\/media\/2710"}],"wp:attachment":[{"href":"https:\/\/www.dpriver.com\/blog\/wp-json\/wp\/v2\/media?parent=2696"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dpriver.com\/blog\/wp-json\/wp\/v2\/categories?post=2696"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dpriver.com\/blog\/wp-json\/wp\/v2\/tags?post=2696"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}