Car-Racing Example, Entity Relationships

Driver, car-race, and team entities are presented, together with the relationships among them. You define entities that correspond to your application documents in order to help you determine the tables needed to define the duality views for your application.

From the documents to be used by your application you can establish entities and their relationships. Each entity corresponds to a document type: driver, race, team.

Unlike the corresponding documents, the entities we use have no content overlap - they’re normalized. The content of an entity (what it represents) is only that which is specific to its corresponding document type; it doesn’t include anything that’s also part of another document type.

Two entities are related according to their cardinality. There are three types of such relationships:1

One-to-one (1:1)

An instance of entity A can only be associated with one instance of entity B. For example, a driver can only be on one team.

One-to-many (1:N)

An instance of entity A can be associated with one or more instances of entity B. For example, a team can have many drivers.

Many-to-many (N:N)

An instance of entity A can be associated with one or more instances of entity B, and conversely. For example, a race can have many drivers, and a driver can participate in many races.

See Also: Entity-relationship model

A many-to-one (N:1) relationship is just a one-to-many relationship looked at from the opposite viewpoint. We use only one-to-many.

See Figure 2-1. An arrow indicates the relationship direction, with the arrowhead pointing to the second cardinality. For example, the 1:N arrow from entity team to entity driver points toward driver, to show that one team relates to many drivers.

Figure 1: Car-Racing Example, Directed Entity-Relationship Diagram (1)

Description of image follows

Description of the illustration car-racing_directed_entity-relationship.png

A driver can only be associated with one team (1:1). A team can be associated with multiple drivers (1:N). A driver can be associated with multiple races (N:N). A race can be associated with multiple drivers (N:N).

Related Topics

See Also: Database normalization (Wikipedia)

  1. In the notation used here, N does not represent a number; it’s simply an abbreviation for “many”, or more precisely, “one or more”.