Skip to main content

Entity Relationship diagrams allow you to represent elements of your databases visually using entities. They also allow you to represent the relationships between your databases using relationships. 

Zrz_213Dtp2y5-rDHmyXzQ.png

In this example an ERD has been built to represent the relationships between six school databases:

  1. Students
  2. Groups
  3. Teachers
  4. Subjects
  5. Subject Teacher
  6. Marks

Each database contains information that relates to information in another database but to avoid confusion the data is organized into separate databases. Without Entity Relationship diagrams (ERDs) it can be difficult to understand what information is stored in your databases and how to use that to your benefit. ERDs set you up for success because they allow you to visualize and in turn better understand how your databases relate to each other.

Here you can find one entity shape for each database: Marks Students Groups Subjects Subject Teacher and Teachers. Beneath each entity you find various attributes or additional information that are directly related to the parent entity. These attributes correspond to columns in a database while entities correspond to rows. Notice how each student has basic attributes such as a unique student ID a first name and a last name. Each student is also a part of a group which is why you see a “GroupID” attribute under the Students entity. The same is true for the Teachers entity; each teacher has a unique ID (“TeacherID”) a first name and a last name. These entity shapes give you a basic outline of the information you can expect to find in each respective database without the need to open databases individually.

By connecting the entity shapes with these lines a simple visualization that specifically explains how the databases relate to one another has been created. 

Take a look at the Groups entity in the ERD example (zoomed in below). You can see that although the Groups entity only contains two attributes (“GroupID” and “Name”) there are two lines which connect to the entity: one from the Students entity and one from the Subject Teacher entity.

7PDZ0JlN9PVNEYm-4Vj3-Q.png

You can see that both the Students and Subject Teacher entities contain an attribute called “GroupID” and the lines that connect from the “GroupID” attributes within each entity show a direct relationship to the Groups entity. In other words the lines show that the “GroupID” attributes in the Students and Subject Teacher entities are the same as the “GroupID” attribute in the Groups entity.

Additionally you can reference the cardinality guide shown in our Entity Relationship Diagrams article from the help center to determine a few important details about the relationships between these entities.

In this example the ERD shows:

iBgV2q1neJRvC5PTcRrV7A.png

  • Each group has at least one student but could have more students as shown by the one or many line connection.

NE2L4B62rh0HRG-TECQ7ZQ.png

  • Each student can be a part of zero to many groups as shown by the zero or many line connection.

hBtwDoks6S-qBfN-uKbXOw.png

  • Each subject teacher has one group as shown by the one line connection.

PkDuEWM0nPqstUeTqr35Kw.png

  • Each group has many subject teachers as shown by the many  line connection.

Begin your work with the School ERD template from this example or check out our other ERD templates. Please follow up in the comments with any questions or examples of how you utilize ERDS to represent relationships between your databases!

Never Mind, before exporting I used the arrange feature, I just undo it and there they are

😁

------------------------------------------------
When I export my ERD to SQL, i don’t get the relations in the script.

 

I there something missing with the diagram?


@Mohannad Hakmeh Thanks so much for your question and update - glad to hear that things are working as expected! Please let me know if there is anything else I can do to support your work. 


Reply