Relationship Types in the ER Model
Relationship Types in the ER Model
In the initial conceptual design of a database, many relationships between entities are hidden inside attributes. For example, when an attribute of one entity type refers to another entity type, it implicitly represents a relationship. As the design is refined, these references must be explicitly modeled as relationships in the ER model.
Why Relationships Are Needed
In the COMPANY database, several attributes actually represent associations:
-
Manager (DEPARTMENT → EMPLOYEE)
-
Controlling_department (PROJECT → DEPARTMENT)
-
Supervisor (EMPLOYEE → EMPLOYEE)
-
Department (EMPLOYEE → DEPARTMENT)
In the ER model, relationships should not be represented as attributes. Instead, they must be modeled using relationship types, which clearly express how entities are connected in the miniworld.
Relationship Types and Relationship Sets
Relationship Type
A relationship type defines a meaningful association among two or more entity types.
Example:
-
WORKS_FOR between EMPLOYEE and DEPARTMENT
This specifies that employees work for departments.
Relationship Set
The relationship set is the collection of all actual associations that exist at a given time.
-
Each association is called a relationship instance
-
A relationship instance links one entity from each participating entity type
Mathematically:
-
A relationship set is a subset of the Cartesian product of the participating entity sets
Relationship Instance
A relationship instance represents a single real-world fact.
Example:
-
(Employee e1, Department d1) ∈ WORKS_FOR
→ Employee e1 works for Department d1
Each instance includes exactly one entity from each participating entity type.
Participation of Entities
-
An entity type is said to participate in a relationship type
-
An entity participates in a relationship instance
In the WORKS_FOR example:
-
EMPLOYEE and DEPARTMENT participate in WORKS_FOR
-
Individual employees (e1, e2, …) participate in specific WORKS_FOR instances
ER Diagram Representation
In ER diagrams:
-
Entity types → Rectangles
-
Relationship types → Diamonds
-
Connections → Straight lines between entities and relationships
Example:
This graphical notation makes relationships explicit and easier to understand than embedded attributes.
Key Takeaways
✔ Relationships represent associations among entities
✔ Relationship types describe the structure; relationship sets capture actual data
✔ Each relationship instance connects one entity from each participating entity type
✔ Attributes that reference other entities should be converted into relationships
✔ ER diagrams use diamonds to represent relationship types


Comments
Post a Comment