ER Diagrams
Course Content Specification
Describe and exemplify entity-relationship diagrams with three or more entities, indicating:
entity name
attributes
name of relationship
cardinality of relationship (one-to-one, one-to-many, many-to-many)
An Entity-relationship (E-R) diagram is a graphical representation of the entities in a system. It is used to summarise the relationship that exists between two or more entities.
An E-R diagram indicates:
The name of each entity.
The name of the relationship between two entities.
The cardinality of the relationship between two entities.
If required, the name of each attribute can be shown.
Structure of an ER Diagram
In an E-R diagram:
Each entity is shown as a labelled rectangle.
Each attribute, if required, is represented as labelled ovals.
Each relationship is illustrated by a labelled line which joins the entities.
Although different representation can be used to indicate the many side of the relationship all the examples will use the crow's feet notation.
Every Primary Key to Foreign Key relationship is always one-to-many with the many part of the relationship on the the foreign key side.
E-R diagrams - worked example
A relational database is used by a travel agency to store details of Scottish holiday resorts and hotels in each resort. The entities, attributes and keys are shown in the tables below:
The resulting E-R diagram is shown below:
E-R diagrams can also show the attributes that are stored in each entity.
In a coursework or exam at Higher you usually would not be required to add all of the attributes of each entity.