E-R Diagram Overview
In this section you will learn
- What an entity-relationship diagram is
- How to represent different types of associations
- Understand labeled associations
Entity-Relationship (E-R) diagrams are a common way of describing objects in a system (entities) and how they correlate to one another (relationships). This type of documentation is very common in defining data structures and flow, especially database architectures. Therefore, this technique has been very popular with Information Technology organizations.
There are four basic associations. In Figure 1, for each occurrence of A, there is one and only one occurrence of B. The example reads “A unicycle has one and only one wheel.”
Figure 1: One and Only One Association (Also known as One-to-One)
In Figure 2, for each occurrence of A, there is zero or one occurrence of B. In this example, a car can have zero or one hatchbacks.
Figure 2: Zero or One Association
In Figure 3, for each occurrence of A, there is one or more occurrence of B. A house has one or more bathrooms.
Figure 3: One or More Association (Also known as One-to-Many)
In Figure 4, for each occurrence of A, there is zero, one, or more occurrences of B. A meal can have zero, one, or more desserts.
Figure 4: Zero, One, or More Association
Many E-R diagrams include labeled associations, as in Figure 5. In the example, the association would be read as “A Surfer Dude owns one or more Surf Boards,” or (more succinctly) “Surfer Dude owns Surf Boards.”
Figure 5: Labeled Association
E-R diagrams need not focus on physical objects. In fact, many of the E-R diagrams we will be using are more procedurally oriented. For example, in Figure 6, a procedure consists of an ordered set of operator instructions.
Figure 6: Procedural Association