Use Sophia to knock out your gen-ed requirements quickly and affordably. Learn more
×

Entity-Relationship Model

Author: Sophia

what's covered
This tutorial explores the entity-relationship diagram with the Chen and Crow’s Foot notation as well as the class diagram in four parts:
  1. Three Notation Styles
  2. Chen Notation
  3. Crow's Foot Notation
  4. UML Notation

1. Three Notation Styles

The entity-relationship model was created to help describe relationships among data in a graphical format. You will hear the term "entity-relationship diagram" (ERD) or "entity-relationship model" (ERM) quite often to describe the entities and the relationships that they model.

did you know
Peter Chen first introduced the entity-relationship data model in 1976.


The model represents entities or tables in an ERD with a rectangle, which is also known as an "entity box". The name of the entity or table is written in the center of the rectangle. The entity name is generally written in capital letters and in the singular form. An entity can then consist of a set of attributes that has characteristics of the entity. For example, in our Postgres database, the ARTIST entity contains the attributes of artist_id and the artist_name.

Next, we have relationships that describe the associations between the entities. The data relationships are either one-to-many, many-to-many, or one-to-one. These relationships show the connectivity between those entities. Generally, the name of the relationship is a verb that explains what the relationship is. In our example, an ARTIST can RECORD many ALBUMs.

There are three common notations that are used to represent relationships in an ERD: Chen notation, Crow’s Foot, and UML class diagram notation.

  • Chen notation is used to help illustrate modeling concepts, and is a great notation to use when performing the initial design. However, it can get messy quickly, as more relationships, entities, and attributes are added.
  • Crow’s foot notation is the most widely used standard.
  • UML class diagram notation is used for object-oriented or object/relational databases.

2. Chen Notation

Chen notation is based on Peter Chen’s approach. For a relationship, each entity (represented by the rectangle) is connected by a diamond that contains the relationship name within it. On the relationship line, there is a representation of the connectivity: either a one-to-one relationship, a one-to-many relationship, or a many-to-many relationship. Attributes of an entity or table would be listed in ovals connected to the rectangle.

Chen notation for a one-to-one relationship between table1 and table2 would look like the following:

Chen Notation for One-to-One Relationship

Chen notation for a one-to-many relationship between table1 and table2 would look like the following:

Chen Notation for One-to-Many Relationship

Chen notation for a many-to-many relationship between table1 and table2 would look like the following:

Chen Notation for Many-to-One Relationship


3. Crow's Foot Notation

Crow’s Foot notation (below) is slightly different. Notice that the relationship name is placed above the relationship line, instead of in a diamond. The rectangles still contain the table name at the top, but then would list the attributes below the table name. The relationship line shows a short bisecting line segment if it is on the “one” side and a crow’s foot (two short bisecting lines) if it is on the "many" side.

Crow’s Foot notation for a one-to-one relationship between table1 and table2 would look like the following:

Crow's Foot Notation for One-to-One Relationship

Crow’s Foot notation for a one-to-many relationship between table1 and table2 would look like the following:

Crow's Foot Notation for One-to-Many Relationship

Crow’s Foot notation for a many-to-many relationship between table1 and table2 would look like the following:

Crow's Foot Notation for Many-to-Many Relationship


4. UML Notation

A class diagram (below) uses UML notation, which is similar to Crow’s Foot notation. Notice that the class/entity name is still at the top the rectangle, with attributes below it (and then methods/functionality below that). The connectivity is defined along the relationship line with symbols on each side, like 1..1 for one, and 1..* for many.

UML class diagram notation for a one-to-one relationship between table1 and table2 would look like the following:

UML Class Diagram Notation for One-to-One Relationship

UML class diagram notation for a one-to-many relationship between table1 and table2 would look like the following:

UML Class Diagram Notation for One-to-Many Relationship


UML class diagram notation for a many-to-many relationship between table1 and table2 would look like the following:

UML Class Diagram Notation for Many-to-Many Relationship


summary
There are three common notation styles used to represent entity relationships in entity-relationship diagrams: Chen notation, Crow’s foot notation, and UML class diagram notation. Chen notation is especially good for initial design. Crow's foot notation is the most commonly used in practice. UML notation is preferred in object-based databases.

Source: Authored by Vincent Tran