Generate the ERD for an existing database [closed] - database

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
This post was edited and submitted for review 1 year ago and failed to reopen the post:
Original close reason(s) were not resolved
Improve this question
I have a PostgreSQL database. I want to generate ERD from that database. Are there any built-in tools to do it or maybe some third-party tools?

You can use dbeaver to do this. It allows you to export the ER diagram as png/svg etc.
DBeaver - https://dbeaver.io/
Double click on a schema (eg, Schemas->public->Tables) and open the "ER Diagram" tab (next to "Properties" tab)

pgAdmin 4 version 30 and newer can generate the ERD from an existing database. Just right-click on the database and select Generate ERD.

We used DBVisualizer for that.
Description:
The references graph is a great feature as it automatically renders all primary/foreign key mappings (also called referential integrity constraints) in a graph style. The table nodes and relations are layed out automatically, with a number of layout modes available. The resulting graph is unique as it displays all information in an optimal and readable layout.
from its site

pgModeler can generate nice ER diagram from PostgreSQL databases.
https://pgmodeler.io/
License: GPLv3
It seems there is no manual, but it is easy enough without manual. It's
QT application. AFAIK, Fedora and Ubuntu has package. (pgmodeler)
In the latest version of pgModeler (0.9.1) the trial version allows you to create ERD (the design button is not disabled). To do so:
Click Design button to first create an empty 'design model'
Then click on Import and connect to the server and database you want (unless you already set that up in Manage, in which case all your databases will be available to select in step 3)
Import all objects (it will warn that you are importing to the current model, which is fine since it is empty).
Now switch back to the Design tab to see your ERD.

Download DbVisualizer from : https://www.dbvis.com/download/10.0
and after installing create database connection:
Change highlighted detail of your db and test by click ping server. Finally click connect
Enjoy.

I wrote this utility, it automatically generates the DSL code from a postgres database which you can then paste into dbdiagram.io/d website to get ER diagrams
https://github.com/nsingla/dbdiagrams

Our team use Visual Paradigm to generate ER diagram from database in many of our projects. While we mainly work on MS SQL and Oracle, as I know they also support some other DBMS like PostgreSQL, MySQL, Sybase, DB2 and SQLite.
Steps:
Select Tools > DB > Reverse Database... from the toolbar of Visual
Paradigm
Keep the settings as is and click Next Select PostgreSQL as
driver and provide the driver file there. You can simply click on
the download link there to get the driver.
Enter the hostname, database name, user and password, and then click Next
They will then study your database and lists out the tables in it.
Select the table to form an ERD and continue, and that's it. An ERD will be generated with the tables you selected presented.
BTW they also support generating and updating database schema from ERD.
Hope this helps. :-)
More information about generating ERD from PostgreSQL database

ERBuilder can generate ER diagram from PostgreSQL databases (reverse engineer feature).
Below step to follow to generate an ER diagram:
• Click on Menu -> File -> reverse engineer
• Click on new connection
• Fill in PostgresSQL connection information
• Click on OK
• Click on next
• Select objects (tables, triggers, sequences…..) that you want to reverse engineer.
• Click on next.
If you are using trial version, your ERD will be displayed
automatically.
If your are using the free edition you need to drag
and drop the tables from the treeview placed in the left side of application

Another option is use Oracle SQL Developer. Two steps as below:
(1) First of all, you need to connect SQL Developer to your PostgreSQL database.
(2) Then you can generate an entity-relationship (ER) diagram using SQL Developer

Perhaps have a look at AquaFold's Aqua Data Studio. It is a database IDE with entity-relationship diagramming. It also includes data profiling. It is not free but its price is very reasonable considering its capabilities.

I use DrawERD for ERD & DB doc. https://drawerd.com

postgresql_autodoc is a cli for doing this. Doesnt do cardinality, but none of the above mentioned GUI tools do as well.

You can generate ER diagram from PgAdmin.
Open PgAdmin
Right click on any table and select statement and it will show two window one is query other is graphical window so you can add the table which you want to generate the diagram.
To save go to save as and select Graphical Query (image)

Open MySQL Workbench. In the home screen click 'Create EER Model From Existing Database'. We are doing this for the case that we have already made the data base and now we want to make an ER diagram of that database.
Then you will see the 'Reverse Engineer Database' dialouge. Here if you are asked for the password, provided the admin password. Do not get confused here with the windows password. Here you need to provide the MySQL admin password. Then click on Next.
In the next dialouge box, you'll see that the connection to DBMS is started and schema is revrieved from Database. Go next.
Now Select the Schema you created earlier. It is the table you want to create the ER diagram of.
Click Next and go to Select Objects menu. Here you can click on 'Show Filter' to use the selected Table Objects in the diagram. You can both add and remove tables here.Then click on Execute.
6.When you go Next and Finish, the required ER diagram is on the screen.

Related

Using SSDT to do reverse engineering so I can get overview of schema just like in MySQL

I just installed and imported my database in Visual Studio , All I want to see is schema to get a quick relation of among different tables , I was hoping if I could get a way to do the same in SQL server just like it can be done with my sql reverse engineering
I use Azure data studio (the extension is buggy ), I also have Sql server manangement studio , I also visual studio and selected database management pack where SSDT was included and now I simply imported the database which I want schema for
SSMS has some rudimentary diagram tools to pull in objects and see any relations that exist. Something to watch for is that if you add any relations or modify anything other than the layout on that diagram, you actually change the database itself.
There are some free/cheap ERD apps/sites that you may want to investigate and many will give you a script to run in SQL Server to extract the schema in a format they can use.
I'd recommend searching on ERD apps that can do database diagrams, but for a free option you may want to check out https://dbschema.com/ (there's a free/trial version) or https://dbdiagram.io as they can handle some simple ER diagrams. (note - no affiliation to either, just some examples/options)
You can't easily forward-engineer changes with it, but it can work to just see the relationships visually. If you're going to use ER diagrams regularly, a paid option will be much more helpful. There are a lot of options available, but for that sort of design work you probably want collaboration and the ability to push out changes to a live database from the ERD.

What makes up the table I can see in SSMS?

A question out of pure curiousity;
When i'm installing SQL Server 2016 Developer edition on my developer machine, I choose custom installation and have the option to pick "Database Engine Services". Is selecting this option what makes me able to see tables and columns in the first place? (through tools like SSMS). I guess that SSMS is just a tool to take the stored data and display it in the view we daily refer to by saying "tables".
No, the database engine services are what allows your computer to create and store databases and tables and all their component objects. It also allows your computer to process queries against those objects. It has nothing to do with being able to see them.
The information in the "Feature Description" box in your screenshot pretty much answers your question.

How can I generate an entity–relationship (ER) diagram of a database using Microsoft SQL Server Management Studio?

I want to generate an ER diagram of an SQL database using Microsoft SQL Server Management Studio (SMSS). However, I don’t know how to.
I found this technique online: Making ER Diagram from SQL Server 2008 Database
However, I am not able to see "Database Node" or "Database Diagrams" nodes as mentioned in the first and second steps.
Hence, how can I generate an ER diagram from an existing database?
From the comments, I realize that I was right in my understanding that Database node means the node with my database name. But then my problem is I am not able to find the "Database Diagrams" node under my Database name. What should I do so that I can see it?
PS: It’s not a local database.
Go to SQL Server Management Studio →
Object Explorer →
Databases →
Choose and expand your database.
Under your database, right click on "Database Diagrams" and select "New Database Diagram".
It will a open a new window. Choose tables to include in the ER diagram (to select multiple tables, press Ctrl or Shift key and select tables).
Click Add.
Wait for it to complete. Done!
You can save the generated diagram for future use.
Diagrams are back as of the 2019-06-11 release
Download the latest
As stated:
Yes, we’ve heard the feedback; Database Diagrams is back.
SQL Server Management Studio (SSMS) 18.1 is now generally available
Note: The latest version does not include it
Sadly, the last version of SSMS to have database diagrams as a feature was version v17.9.
Since that version, the newer preview versions starting at v18.* have, in their words "...feature has been deprecated".
Hope is not lost though, for one can still download and use v17.9 to use database diagrams which, as an aside for this question, is technically not an ER diagramming tool.
As of this writing it is unclear if the release version of 18 will have the feature. I hope so because it is a feature I use extensively.
From Object Explorer in SQL Server Management Studio, find your database and expand the node (click on the + sign beside your database). The first item from that expanded tree is Database Diagrams. Right-click on that and you'll see various tasks including creating a new database diagram. If you've never created one before, it'll ask if you want to install the components for creating diagrams. Click yes then proceed.
As of 2019-10, for SQL Server Management Studio, they did not upgrade it to add the create ER Diagram feature.
I would suggest try using DBeaver:
I am using both Mac and Windows and I was able to download the community edition. I logged into my SQL server database and was able to create the ER diagram using the DBeaver.

Write Access Client App for SQL Server 2005 Backend

I'm writing an inventory/payroll system, and I'm storing all the records on a remote server running SQL Server 2005 on Windows Server 2008 R2. I was wondering how I could start writing forms(very basic) in MS-ACCESS 2010 to upload things to the database. I just want to test it out to make sure that once I implement the entire database, things will work smoothly and without error. I want to figure out how to just make a single form that will be connected to the database, right now the form will just be a simple single text input with a submit button, that will be uploading barcodes(strings not images).
If I need to clarify anything, please just ask.
Thanks in advance for any help
Microsoft has tons of useful "Getting Started" articles.
This one explains how to connect to SQL Server: http://office.microsoft.com/en-us/access-help/import-or-link-access-to-sql-server-data-HA010341762.aspx
This one covers all sorts of forms: http://office.microsoft.com/en-us/access-help/CH010369205.aspx
Go there, you will find a lot that can help you with whatever you are going to do.
Make sure you have the SQL Client driver installed on the workstation where you'll be using MS Access. You can download it here (look for sqlcnli).
The simplest way to get started is to build an ODBC DSN. Access can then link to your SQL Server tables using that DSN. How to Create a DSN
In Access, Go to the "External Data" option and choose ODBC. Locate your DSN and then select which tables you want Access to be linked to.
After your linked tables are showing up in the tables list, click on one of the tables, go to the Create tab (2007, not sure about 2010) and choose Form. This should automatically create a form for you using the table you had selected when you clicked the Form button. There's no need to write code or add buttons to this form. The default form can do all CRUD operations as long as permissions for all CRUD have been granted to the username you used when you created your DSN.
Some developers prefer to use ADO (code only, no linked tables or form wizards) or Pass Through Queries to access SQL Server from Access. I can't really tell you what you should be using because it depends on so many different factors including (but not limited to) size of project, amount of records, skill level, personal preferences, etc.

Automating reverse engineer database model with Visio

We develop and maintain our database schema with a custom tool. SQL scripts and runtime files are generated from that tool. However, it does not provide a very good visual representation.
Lately I been using Visio to reverse engineer the schema. This is working great so far. But to be able to do this, I need to:
create an empty database
execute the generated script
start up visio
choose reverse engineering and choose the created database
select all tables, etc
wait for generation
I really want to automate this process. Step 1 and 2 are easy, but how can I automate the other steps.
I've been looking for a C# library to create Visio diagrams, but they al seem not suitable for this task.
For instance
http://visioautomation.codeplex.com/ and http://www.graphviz.org/ look promising, but on a closer look they were not appropriate.
I've tried to record macro, but the macro recorder does not work in conjuction with the reverse engineering tools.
Michiel,
I am using Visio 2007 and SQLite 3.
Tonight I had a crack at reverse engineering my Sqlite3 database with success. The key is to download an ODBC driver for Sqlite. I found some here > http://www.ch-werner.de/sqliteodbc/. I installed the current one at the top of the list "sqliteodbc.exe".
Then the MSVisio set up was a bit muddled so forgive me if I do not explain the details in an exact, repeatable format.
The new installed ODBC driver should appear in Visio when you select: Database > Reverse Engineer > Setup.
Scroll down and check one of the three Sqlite drivers - I chose the "SQLite3 ODBC Driver"
Then click on "New" > Check "System Data Source" > Scroll down select "SQLite3 ODBC Driver" > Click "Finish"
On the dialog that it entitled "ODBC DNS Configuration" is where you enter your Sqlite database settings. The "Database Name" is simply the path and file name of your database.
The "Data Source Name" can be anything meaningful to you as it will appear in the Visio dropdown whenever you want to reverse engineer. There are some other settings you can experiment with as well.
When you commence reverse engineering you will be asked to connect to your datasource using your credentials. At this point you will get a warning ...
Warning! You are using a Visio
'ODBC Generic Driver' to connect
with a 'SQLite' DBMS datasource. By using
an incompatible driver, it is possible
that the catalog information retrieved
will be incomplete.
Just click 'OK' and ignore this.
Unfortunately, in the next screen the option to select "Views" and "Triggers" are greyed out (you can select Tables: Primary Keys, Indexes, Foreign Keys though). This is a shame as I have defined a lot of these in my schema and I have benefited from rev-enging these in Oracle many times in the past.
That is it. Hope someone can find a fix for rev-enging the views.
Dan
Have you tried using the "Refresh" feature? I'm not sure if that is a 2010 thing or if it was always there. You point it at the database and it updates your model with the changes since last time.

Resources