Entity Relationship Diagram

An entity relationship diagram (ERD) shows the relationships of entity sets stored in a database. An entity in this context is a component of data. In other words, ER diagrams illustrate the logical structure of databases.

At first glance an entity relationship diagram looks very much like a flowchart. It is the specialized symbols, and the meanings of those symbols, that make it unique.

Entity Relationship Diagram

The History of Entity Relationship Diagrams

Peter Chen developed ERDs in 1976. Since then Charles Bachman and James Martin have added some slight refinements to the basic ERD principles.

Structure of an Entity Relationship Diagram with Common ERD Notations

An entity relationship diagram is a means of visualizing how the information a system produces is related. There are five main components of an ERD:

  • Entities, which are represented by rectangles. An entity is an object or concept about which you want to store information. Entity - ERD Symbol A weak entity is an entity that must defined by a foreign key relationship with another entity as it cannot be uniquely identified by its own attributes alone. Weak entity - ERD Symbol
  • Actions, which are represented by diamond shapes, show how two entities share information in the database. In some cases, entities can be self-linked. For example, employees can supervise other employees.
    Self-linked Action - ERD Symbol
  • Attributes, which are represented by ovals. A key attribute is the unique, distinguishing characteristic of the entity. For example, an employee's social security number might be the employee's key attribute.
    Attribute - ERD Symbol A multivalued attribute can have more than one value. For example, an employee entity can have multiple skill values. Multi-valued Attribute - ERD Symbol A derived attribute is based on another attribute. For example, an employee's monthly salary is based on the employee's annual salary. Derived Attribute - ERD Symbol
  • Connecting lines, solid lines that connect attributes to show the relationships of entities in the diagram.
  • Cardinality specifies how many instances of an entity relate to one instance of another entity. Ordinality is also closely linked to cardinality. While cardinality specifies the occurrences of a relationship, ordinality describes the relationship as either mandatory or optional. In other words, cardinality specifies the maximum number of relationships and ordinality specifies the absolute minimum number of relationships.
    Cardinality - ERD Symbol There are many notation styles that express cardinality.
    Information Engineering Style
    Information Engineering Style Cardinality - ERD Chen Style
    Chen Style Cardinality - ERD Bachman Style
    Bachman Style Cardinality - ERD Martin Style
    Martin Style Cardinality - ERD

Entity Relationship Diagram Uses

When documenting a system or process, looking at the system in multiple ways increases the understanding of that system. ERD diagrams are commonly used in conjunction with a data flow diagram to display the contents of a data store. They help us to visualize how data is connected in a general way, and are particularly useful for constructing a relational database.

How to Create an Entity Relationship Diagram

Here are some best practice tips for constructing an ERD:

  • Identify the entities. The first step in making an ERD is to identify all of the entities you will use. An entity is nothing more than a rectangle with a description of something that your system stores information about. This could be a customer, a manager, an invoice, a schedule, etc. Draw a rectangle for each entity you can think of on your page. Keep them spaced out a bit.
    ERD entities
  • Identify relationships. Look at two entities, are they related? If so draw a solid line connecting the two entities.
  • Describe the relationship. How are the entities related? Draw an action diamond between the two entities on the line you just added. In the diamond write a brief description of how they are related.
  • Add attributes. Any key attributes of entities should be added using oval-shaped symbols.
  • Complete the diagram. Continue to connect the entities with lines, and adding diamonds to describe each relationship until all relationships have been described. Each of your entities may not have any relationships, some may have multiple relationships. That is okay.

How to Build an Entity Relationship Diagram with SmartDraw

SmartDraw's automated format makes it easy to create an ERD, and hundreds of other diagrams, in minutes.

Start with an ERD template then add entities, actions, and attributes by clicking simple commands in the SmartPanel.

To add an ERD symbol to your page, click on it and without releasing the mouse, drag it to the page or just click once in the page to stamp it.

To connect an attribute or an action to any entity on the page, select the appropriate symbol from the SmartPanel and click "Add Right" to automatically connect it.

Add an entity

You can also hold down the [CTRL] key and hit the right arrow key to achieve the same effect.

Use the keyboard

Keep adding symbols as necessary.

If you need to move an entity or attribute, just click to select it and drag it to its new position. As you move the shape, you'll notice SmartDraw's automatic connector will attempt to grab it. SmartDraw shows you a dashed outline of where your step will be if you let go of your mouse. To drop a shape into place, simply let go of your mouse. Your ER diagram will automatically readjust itself without any manual redrawing required.

To delete a step, just select it and hit delete. Again, SmartDraw's automation will allow the diagram to reflow automatically.

Drawing Cardinality

You can represent cardinality and ordinality by adding arrowheads to the lines connecting entities. To do so, select a line, go to Arrowheads under the Lines menu, and go to More Styles under Arrowheads. Choose the appropriate arrowhead for the type of relationship you want to illustrate.

Drawing cardinality

Tips for Effective ER Diagrams

  1. Make sure that each entity only appears once per diagram.
  2. Name every entity, relationship, and attribute on your diagram.
  3. Examine relationships between entities closely. Are they necessary? Are there any relationships missing? Eliminate any redundant relationships. Don't connect relationships to each other.
  4. Use colors to highlight important portions of your diagram.