Other Styles of E-R Diagram
The text uses one particular style of diagram. Many variations exist.
Some of the variations you will see are:
- Diamonds being omitted – a link between entities indicates a relationship.
- Less symbols, clearer picture.
- What happens with descriptive attributes?
- In this case, we have to create an intersection entity to possess the attributes.
- Numbers instead of arrowheads indicating cardinality.
- Symbols, 1, n and m used.
- E.g. 1 to 1, 1 to n, n to m.
- Easier to understand than arrowheads.
- A range of numbers indicating optionality of relationship. (See Elmasri & Navathe, p 58.)
- E.g (0,1) indicates minimum zero (optional), maximum 1.
- Can also use (0,n), (1,1) or (1,n).
- Typically used on near end of link – confusing at first, but gives more information.
- E.g. entity 1 (0,1) — (1,n) entity 2 indicates that entity 1 is related to between 0 and 1 occurrences of entity 2 (optional).
- Entity 2 is related to at least 1 and possibly many occurrences of entity 1 (mandatory).
- Multivalued attributes may be indicated in some manner.
- Means attribute can have more than one value.
- E.g. hobbies.
- Has to be normalized later on.
- Extended E-R diagrams allowing more details/constraints in the real world to be recorded.
- Composite attributes.
- Derived attributes.
- Subclasses and superclasses.
- Generalization and specialization.
Roles in E-R Diagrams
The function that an entity plays in a relationship is called its role. Roles are normally explicit and not specified.
They are useful when the meaning of a relationship set needs clarification.
For example, the entity sets of a relationship may not be distinct. The relationship works-for might be ordered pairs of employees (first is manager, second is worker).
In the E-R diagram, this can be shown by labelling the lines connecting entities (rectangles) to relationships (diamonds). (See figure 1).
Weak Entity Sets in E-R Diagrams
A weak entity set is indicated by a doubly-outlined box. For example, the previously-mentioned weak entity set transaction is dependent on the strong entity set account via the relationship set log.
Figure 2) shows this example.
Non-binary relationships can easily be represented. Figure 3) shows an example.
This E-R diagram says that a customer may have several accounts, each located in a specific bank branch, and that an account may belong to several different customers.