Design

Course Content Specification

Some Terminology

In the development of a complex database system, entity-relationship modelling is used to plan the structure of the database. In entity-relationship modelling, specialist terminology is used to define each component of the model. This terminology includes:

Entity

Entity occurrence

Attribute

Primary key

Foreign key

Compound key

Relationship

Entity-occurrence diagram

Entity-relationship diagram

Cardinality (recap)

The cardinality of a relationship defines the number of participants in the relationship. It states the number of entity occurrences in one entity that are associated with one occurrence of the related entity. Cardinality can be:

Cardinality : one-to-one relationship (1:1)

Each entity is associated with only one entity occurrence within a related entity.

For example:

A description of the relationship can be generated by reading across the diagram in both directions:  Each school is managed by one Headteacher while each Headteacher manages one school.

Cardinality : one-to-many relationship (1:M)

Each entity can be associated with one or more entity occurrences within a related entity.

For example:

A description of the relationship can be generated by reading across the diagram in both directions:  Each school employs one or more Teachers and each Teacher is employed by only one School.

Cardinality : many-to-many relationship (M:N)

Several occurrences of an entity can be associated with multiple entity occurrences within a related entity.

For example:

A description of the relationship can be generated by reading across the diagram in both directions:  Each Student studies one or more Subjects and each Subject is studied by one or more Students.

Whilst many-to-many relationships are fine between two entities during the modelling stage this cannot be implemented by a relational database system.

To overcome this problem, many-to-many relationships can be resolved to form 2 one-to-many relationships. You will notice that in the example below we have introduced a new intermediate/linking table. This would hold usually hold the compound key which would consist of the primary key of the Student table and the primary key of the Subject table.