SQLt/SQL::Translator/SQLFairy is a great tool to create ER diagrams from SQL:
SQL::Translator is a group of Perl modules that manipulate structured data definitions (mostly database schemas) in interesting ways, such as converting among different dialects of CREATE syntax (e.g., MySQL-to-Oracle), visualizations of schemas (pseudo-ER diagrams: GraphViz or GD), automatic code generation (using Class::DBI), converting non-RDBMS files to SQL schemas (xSV text files, Excel spreadsheets), serializing parsed schemas (via Storable, YAML and XML), creating documentation (HTML and POD), and more.
In Ubuntu Linux and Debian Linux, this can be obtained by installing SQLFairy:
apt-get install sqlfairy
This is quite useful if you follow a bottom-up approach: create the SQL first, and then create ER diagrams – although this might not be a common development method, it does have its uses, and some of us like it ![]()
So for instance, say you have a MySQL schema named sample.sql. To create a ER diagram with color, named sample_schema.png, run the following in the command line:
sqlt-diagram -d=MySQL -o=sample_schema.png sample.sql --color
where -d=MySQL specified the MySQL driver. Other available drivers can be obtained by:
sqlt -l
Additionally, sqlt can also be used to convert between various database schemas as well.




[...] while searching for another application to do just what I want (and not cost me a cent) I found a post about something that will be extremely [...]
Pingback by ER Diagrams from SQL files | Christian Biggins — November 21, 2008 @ 2:03 am |
any news coming ?
Comment by twefiace — May 23, 2009 @ 4:22 am |
good one…… btw, any utility to generate sql script from a e-r diagram (like visio in win32) ?
Comment by chatura — June 16, 2009 @ 9:24 am |
Works great, as long as you don’t have more than five tables in your database. Anything bigger than that and you get a big mess of lines that go all over the place. Biggest drawback is lack of crow’s feet notation which for me is a must with such diagrams
Comment by zagor — August 25, 2009 @ 3:19 am |
its very good
Comment by al3boshi — October 6, 2009 @ 9:28 am |