Entity-Relationship Model

ER Diagram
ER diagram of MMORPG from Wikimedia commons

Entities

  • The key attributes have unique values for all entities of the same type. The key attributes identify the entity.

    Entities without key attributes are weak entities. Often weak entities are things associated with other things, such as extras in a movie.

    Entities are drawn as rectangles. The weak ones are bordered by doubled lines.

    Relations

    Relations connect entities. They are drawn with diamonds. Identifying relationships, drawn with two sides, connect weak entities to the source of their identity.

    Attributes

    Attributes are drawn with ovals connected to entities. Multivalued attributea are drawn inside double ovals.

    Cardinalities

    The arcs connected to the relationships are also labeled with cardinalities similar to those seen in UML diagrams. Sometimes “crows feet” are used to denote a one-to-many relation. These are often used with associate entities.

    ER Design tools

    Many database management systems have data modeling tools for documenting databases and drawing ER diagrams. MySQL workbench can do this. These models can be used to generate SQL statements to create the database.

    entityobject entity typeclass attributeclass variable