This graphic shows the entity-relationship (E-R) diagram rules and gives seven relationship diagram examples.
The following terms are defined:
- entity -
- something about which data is collected, stored, and maintained
- attribute -
- a characteristic of an entity
- relationship -
- an association between entities
- entity type -
- a class of entities that have the same set of attributes
- record -
- an ordered set of attribute values that describe an instance of an entity type
End of definition list.
The following symbols are used in the diagrams:
- A rectangle represents an entity type. The name of the entity type will be entered into the rectangle.
- An oval represents an attribute.
- A diamond shape represents a relationship between entities. The name of the relationship will be entered into the diamond shape.
- A horizontal line with a single short vertical line crossing it at each end represents a one-to-one association.
- A horizontal line with a single short vertical line crossing it at one end and three lines branching from the other end represents a one-to-many association.
- A horizontal line with three lines branching from each end represents a many-to-many association.
- A circle on the line at one end indicates a partly optional association.
- Two circles on the line, one at each end, indicate a fully optional association.
- A mutually inclusive association is indicated by separate lines from the horizontal line to each of the entity types at one end.
- A mutually exclusive association is indicated by separate lines from the horizontal line to each of the entity types at one end. The exclusivity is indicated by a dot at the junction of the horizontal line and the branching lines.
End of symbol list.
The figure shows the following seven simple examples:
- One A is associated with one B:
A rectangle on the left represents entity type A. A rectangle on the right represents entity type B. The association between them is represented by a horizontal line. In the center of the line, a diamond shape provides a place to show the name of the relationship. The one-to-one attribute is indicated by two short vertical lines crossing the horizontal line, one near the A rectangle and one near the B rectangle.
- One A is associated with one or more B's:
A rectangle on the left represents entity type A. A rectangle on the right represents entity type B. The association is represented by a horizontal line with a diamond shape in the center. The one-to-many attribute is indicated by one vertical lines near the A rectangle and three branching lines to the B rectangle.
- One or more A's are associated with one or more B's:
A rectangle on the left represents entity type A. A rectangle on the right represents entity type B. The association is represented by a horizontal line with a diamond shape in the center. The many-to-many attribute is indicated by three branching lines to the A rectangle and three branching lines to the B rectangle.
- One A is associated with zero or one B:
A rectangle on the left represents entity type A. A rectangle on the right represents entity type B. The association is represented by a horizontal line with a diamond shape. Two short vertical lines cross the horizontal line, one near the A rectangle and one near the B rectangle. Near the B rectangle, a circle on the line combined with the vertical line indicate that zero or one B may participate in the association. This is a partly optional one-to-one association.
- One A is associated with zero or more B's:
A rectangle on the left represents entity type A. A rectangle on the right represents entity type B. The association is represented by a horizontal line with a diamond shape. A short vertical line crosses the horizontal line near the A rectangle and three lines branch to the B rectangle. Near the B rectangle, a circle on the line combined with the three branching lines indicate that zero or many B may participate in the association. This is a partly optional one-to-many association.
- One A is associated with one B and one C:
A rectangle on the left represents entity type A. Two rectangles are on the right, one represents entity type B and the other represents entity type C. The association is represented by a horizontal line with a diamond shape. On the left, a short vertical line crosses the horizontal line near the A rectangle. On the right, one line branches to the B rectangle and a second line branches to the C rectangle. Near the B rectangle, a vertical line indicates that one B participates in the association with A. Near the C rectangle, a vertical line indicates that one C participates in the association with A.
- One A is associated with one B or one C (but not both):
A rectangle on the left represents entity type A. Two rectangles are on the right, one represents entity type B and the other represents entity type C. The association is represented by a horizontal line with a diamond shape. On the left, a short vertical line crosses the horizontal line near the A rectangle. On the right, one line branches to the B rectangle and a second line branches to the C rectangle. Near the B rectangle, a vertical line indicates that one B participates in the association with A. Near the C rectangle, a vertical line indicates that one C participates in the association with A. At the juncture where the lines branch out of the horizontal line, a dot indicates that either the B or the C can be associated with the A, but not both.
End of examples.
End of description.