image
Entity Relationship Diagrams

What is an entity? 

An entity is anything about which information is recorded. Entities are represented in tables where the rows are individual instances of the entities, and the columns are their attributes. 

 Decorative image: Image showing that an entity can be a person, a thing, an event or a place

| Image: What is an entity? |  

Entities can be: 

  • A Person, for example an EMPLOYEE, STUDENT, PATIENT 
  • A Place, for example a STORE, WAREHOUSE 
  • An Objectfor example a MACHINE, PRODUCT, CAR 
  • An Eventfor example a SALE, REGISTRATION, RENEWAL 
  • A Conceptfor example an ACCOUNT, COURSE 

What is an attribute? 

Attributes are what we want to know about the entities. 

 Decorative image: Image showing attributes of entities, for example attributes of a person can be a name, sex, height, shoe size. Attributes of a thing such as product code, description, size

| Image: What is an attribute? |  

Please note the below:

  • Each attribute can only hold one value at a time. 
  • Each entity needs a unique identifier (key). 
  • Each attribute must depend upon the key. 

Entities and Relationships  

In order to identify the entities and their relationships, we need to look for the NOUNS & VERBS in the requirements where: 

NOUNS are entities 

VERBS are relationships 

Let’s take a look at an Airline System as an example: 

A Passenger buys a Ticket to travel on an Aircraft which carries out a Flight from one Airport to another Airport.  

The entities in this example are the nouns Passenger, Ticket, Aircraft, Flight, Airport and their relationships are the verbs Travel and Carry out. 

Cardinality 

Cardinality specifies the number of each entity that is involved in the relationship.  

There are three types of cardinality: 

  1. One to one (1:1). For example, 1 man is married to 1 woman. 
  1. One to many (1:M) is used to relate 1 instance of entity A with many instances of entity B. An instance of entity A can have many matching instances of entity B, and an instance of entity B has 1 matching instance of entity A. For example, 1 manager manages many employees, each employee is managed by 1 manager. 
  1. Many to many (M:M) is used to relate many instances of entity A with many instances of entity B. An instance of entity A can have many matching instances of entity B, and an instance of entity B can have many matching instances of entity A. For example, a student attends many courses, and a course is taken by many students. 

Going back to our Airline System example, we can now identify the below types: 

  • If we assume that the Ticket is for a single Flight, this is a one-to-one (1:1) type of cardinality. 
  • If the flight has many tickets applying, this would be a one-to-many (1:m) type of cardinality. 
  • It is important to note that the relationships can be expressed differently in each direction. 
  • In a Universal Modelling Language (UML) diagram, we specify the cardinality along our relationship edge: 

 Image showing a UML diagram that specifies the cardinality in our Airline example

| Image: UML diagram example| 

Cardinality is controlled by defined Business Rules, so we can have: 

One passenger can buy multiple tickets 

Or 

One passenger can travel on one ticket 

Cardinality in this example depends on the definition of Passenger; we can think of the passenger as a traveller linked to a specific ticket or we can think of a passenger as a customer. What’s the business rule in this case? We would specify the cardinality according to our business rule. 

 Image showing the cardinality in our airline example

| Image: The cardinality in our Airline example|  

Let’s see below some diagrams representing entity relationships. You will be given more information and the chance to practise using diagram tools during your live event.  

 Image representing entity relationships in ERD using UML notation

| Image: Representing entity relationships in ERD using UML notation. | 

   Image representing entity relationships in ERD using IEM notation

| Image: Representing entity relationships in ERD using IEM notation. | 

 

 Image representing an example of an entity-relationship diagram in the Chen notation

| Image: Example of an entity-relationship diagram in the Chen notation.  | 

 

 Image showing the same 1: M relationship between PAINTER and PAINTING represented in two different notations, the Crow’s Foot Model and the Chen model

| Image: The same 1: M relationship between PAINTER and PAINTING represented in two different notations. | 

The 1: M relationship is ideal in database design. 

Next, you are going to be introduced to the three data model types. 

When you’re ready, select the vertical Learning Path button to continue.

Difficulty
Intermediate
Duration
14m
Students
604
Ratings
4.6/5
Description

This first Course gives an overview of the five main database types and the components and concepts related to Entity Relationship Diagrams.

About the Author
Students
43862
Labs
168
Courses
1745
Learning Paths
45

A world-leading tech and digital skills organization, we help many of the world’s leading companies to build their tech and digital capabilities via our range of world-class training courses, reskilling bootcamps, work-based learning programs, and apprenticeships. We also create bespoke solutions, blending elements to meet specific client needs.