Home » Database Management System » Unit 1: Introduction » What is meant by the degree of a relationship set in an ER model? Explain unary, binary, and ternary relationships with suitable examples. How is a ternary relationship set converted into relational tables?

What is meant by the degree of a relationship set in an ER model? Explain unary, binary, and ternary relationships with suitable examples. How is a ternary relationship set converted into relational tables?

Support this post with a reaction:

4,978 views

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:

  1. Unary Relationship (Degree 1): An association where a single entity set is related to itself (also called a recursive relationship).
    1. Example: An EMPLOYEE manages another EMPLOYEE.
  2. Binary Relationship (Degree 2): An association between two distinct entity sets.
    1. Example: A STUDENT enrolls in a COURSE.
  3. 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.
    1. Example: A SUPPLIER supplies a PART for a specific PROJECT.

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:

  1. Create separate relational tables for each participating entity set (SUPPLIER, PART, and PROJECT).
  2. Create a new separate relationship table for the ternary relationship (SUPPLIES).
  3. Include the Primary Keys of all three participating entities inside the relationship table as Foreign Keys.
  4. 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()