Entity+relationship+diagrams

Introduction
Entities can be related to one another.

For example, consider the entities FOOTBALL MANAGER and FOOTBALL CLUB. The relationship is that a FOOTBALL MANAGER manages a FOOTBALL CLUB.

One-to-One relationships
We can represent this relationship using and [|Entity-Relationship-Diagram] (ERD), as follows:

In the example above, we can read the diagram as saying: A football manager manages a football club.

This is referred to as a One-to-One relationship (1:1) because one football manager manages one football club.

One-to-Many relationships
Now let's think about the entities FOOTBALL CLUB and FOOTBALL FAN. The relationship is that a FOOTBALL club is supported by many FOOTBALL FANS.



In the example above, we can read the diagram as: A football club is supported by many football fans. Note that we indicate the many by the use of crows feet.

This is referred to as a One-to-Many relationship (1:M) because one football club is supported by many football fans.

Many-to-Many relationships
Finally, let's consider the entities FOOTBALLER and FOOTBALL CLUB. The relationship here is that a FOOTBALLER plays for many FOOTBALL CLUBS and a FOOTBALL CLUB has many FOOTBALL PLAYERS.



In the example above, we can read the diagram as: Many footballers play for many football clubs. Note that we indicate the many by the use of crows feet.

This is referred to as a Many-to-Many relationship (M:N)

Cardinality
There are three types of relationship described above:
 * one-to-one
 * one-to-many
 * many-to-many

This is known as the cardinality of the relationship

**Questions**
1. Draw an entity relationship diagram to represent the following relationships:

a. Movie and actor b. Head teacher and school c. Library book and borrowers d. Owner and dog e. Father and daughter f. Computer and mouse

2. Write down two examples of each of the following types of relationship and draw and entity relationship diagram for each.

a. One-to-one b. One-to-many c. Many-to-many