Degree of a Relationship Set
The degree of a relationship set refers to the number of entity sets participating in that relationship. Based on the degree, relationships are classified into the following types:
- Unary Relationship (Degree 1): An association where a single entity set is related to itself (also called a recursive relationship).
- Example: An
EMPLOYEEmanages anotherEMPLOYEE.
- Example: An
- Binary Relationship (Degree 2): An association between two distinct entity sets.
- Example: A
STUDENTenrolls in aCOURSE.
- Example: A
- Ternary Relationship (Degree 3): An association involving three distinct entity sets simultaneously, where all three are required to represent a single real-world event or transaction.
- Example: A
SUPPLIERsupplies aPARTfor a specificPROJECT.
- Example: A
Converting a Ternary Relationship to Relational Tables
A ternary relationship set cannot always be decomposed into multiple binary relationships without losing key structural information.
Conversion Rules:
- Create separate relational tables for each participating entity set (
SUPPLIER,PART, andPROJECT). - Create a new separate relationship table for the ternary relationship (
SUPPLIES). - Include the Primary Keys of all three participating entities inside the relationship table as Foreign Keys.
- The combination of these Foreign Keys (along with any descriptive attributes) forms the Composite Primary Key of the new table.
Schema Conversion Example:
- Table 1:
SUPPLIER(, Supplier_Name)
- Table 2:
PART(, Part_Name)
- Table 3:
PROJECT(, Project_Name)
- Table 4 (Relationship Table):
SUPPLIES(, Quantity)
references
SUPPLIER()
references
PART()
references
PROJECT()