ER Diagrams   «Prev  Next»

Lesson 2 Entity Relationships
ObjectiveDefine the concept of an Entity Relationship

Associations between Entities

Define Concept of Entity Relationship

Entity relationships are associations between entities, which you have come to recognize as links between tables. Typically, a relationship is indicated by a verb connecting two entities. Consider the following two related entities with several attributes listed for each (key attributes are indicated with asterisks).

Two related entities: Employees are assigned to projects OR Projects are assigned to employees.

A general statement about the relationship between the EMPLOYEE and PROJECT entities may be put this way:
  1. Employees are assigned to projects (or)
  2. Projects are assigned to employees.

Although these statements denote an association between the two entities, we know nothing about how the entities are formally related to one another. Until we know considerably more, we cannot convert them into an ER diagram or, ultimately, into linked tables.
For example, one important thing we do not yet know is if the EMPLOYEE entity should insert its key attribute (EmpID) into the PROJECT entity to establish the relationship, or if the PROJECT entity should insert its key attribute (ProjID) into the EMPLOYEE entity. We also do not know if every employee must be assigned to a project, or if deleting an employee record from an Employees table will have an adverse effect on records in a linked Projects table.
Determining how entities are related requires careful interpretation of the business rules uncovered during Requirements Analysis (and the application of common-sense rules). Rules tell the database designer the type of relationship that exists between entities, and the type of participation entities enjoy in relationships.
The next lesson briefly describes the types of relationships that can exist between entities.

While it is true that the entity-relationship model of a database is independent of the formal data model used to express the structure of the data to a DBMS, we often make decisions on how to model the data based on the requirement of the formal data model we will be using. Removing multivalued attributes is one such case and you will also see an example of this when we deal with many-to-many relationships between entities.

Entity Relationships - Exercise

Before moving on to the next lesson, click the Exercise link below to check your understanding of entity relationships.
Entity Relationships - Exercise

Ad Database Modeling