Loading content...
While attribute inheritance receives the most attention in EER discussions, relationship inheritance is equally fundamental and often more impactful in practice. When a supertype participates in a relationship, that relationship automatically applies to all its subtypes—a powerful mechanism that profoundly affects how we model associations, enforce constraints, and query connected data.
Consider the implications: if 'Employee' has a 'WORKS_IN' relationship with 'Department', then every Manager, Engineer, Contractor, and any other Employee subtype automatically participates in that relationship. You don't define the relationship again for each subtype—it flows through the hierarchy just as attributes do.
This page explores the complete mechanics of relationship inheritance, from basic propagation rules to complex scenarios involving cardinality constraints, participation constraints, and relationship attributes. Understanding these concepts is essential for any database professional designing semantically rich hierarchical schemas.
By the end of this page, you will understand how relationships propagate through type hierarchies, how cardinality and participation constraints behave under inheritance, when subtypes can have their own specialized relationships, and the query implications of inherited relationships across complex EER diagrams.
Relationship inheritance is the mechanism by which a subtype automatically participates in all relationships defined for its supertype (and ancestor supertypes). This follows directly from the IS-A semantic: if 'Manager IS-A Employee' and 'Employee WORKS_IN Department', then 'Manager WORKS_IN Department'.
The Formal Definition:
Let S be a supertype with relationship set R_S = {r₁, r₂, ..., rₙ} representing all relationships in which S participates. Let T be a subtype of S with its own local relationship set R_T = {t₁, t₂, ..., tₘ}. Then:
Crucially, inherited relationships are not copies—they are the same relationships. When you query the WORKS_IN relationship, you find employee-department pairs regardless of whether the employee is a Manager, Engineer, or any other subtype.
| Aspect | Attribute Inheritance | Relationship Inheritance |
|---|---|---|
| Basic Mechanism | Subtype has all supertype attributes | Subtype participates in all supertype relationships |
| Identity | Same attribute, not a copy | Same relationship, not a copy |
| Extension | Subtype can add local attributes | Subtype can add local relationships |
| Reduction | Cannot remove inherited attributes | Cannot remove inherited relationships |
| Constraint Flow | Constraints propagate and can strengthen | Cardinality/participation constraints propagate |
| Querying | Supertype queries see inherited values | Supertype relationship queries include subtype instances |
The Participation Principle:
When a supertype participates in a relationship, every subtype instance IS a supertype instance, and therefore CAN participate in that relationship. The inheritance is about capability and constraint, not about mandatory participation (which is governed separately by participation constraints).
Example: Banking System
ACCOUNT (supertype)
├── CheckingAccount (subtype)
├── SavingsAccount (subtype)
└── InvestmentAccount (subtype)
Relationship: ACCOUNT ---OWNED_BY---> CUSTOMER
The OWNED_BY relationship is defined at the ACCOUNT level. Automatically:
You don't create separate CHECKING_OWNED_BY, SAVINGS_OWNED_BY relationships. The single OWNED_BY relationship serves all account types through inheritance.
Relationship inheritance means you can query 'all accounts owned by Customer X' without knowing or caring about account types. The query traverses the inherited OWNED_BY relationship and returns CheckingAccounts, SavingsAccounts, and InvestmentAccounts alike. This is polymorphic querying—a powerful feature enabled by relationship inheritance.
When relationships are inherited, their cardinality constraints propagate as well. This propagation follows specific rules that maintain semantic consistency while allowing appropriate flexibility.
Basic Cardinality Propagation:
If a supertype relationship has cardinality C₁:C₂, subtypes inherit this same constraint. The cardinality applies to subtype instances when they participate in the relationship.
Example:
EMPLOYEE ---MANAGES(0..1)---> PROJECT
(one employee manages at most one project)
Subtypes (Manager, Engineer, Analyst) all inherit this constraint:
The constraint is unified—it's not per-subtype but across the entire hierarchy.
| Supertype Cardinality | Inherited Behavior | Subtype Modification Allowed? |
|---|---|---|
| 1:1 (One-to-One) | Each subtype instance can relate to exactly one entity on other side | Can REDUCE (restrict further), cannot EXPAND |
| 1:N (One-to-Many) | Each subtype instance can relate to many on N-side | Can reduce maximum on either side, cannot increase |
| M:N (Many-to-Many) | No bound on participation from subtype | Can impose bounds where none existed |
| 0..1 (Optional One) | Each subtype instance relates to at most one | Can make mandatory (1..1) but cannot increase max |
| 1..* (At Least One) | Each subtype instance must relate to at least one | Cannot waive minimum; can increase minimum |
The Tightening Principle:
Just as with attribute constraints, relationship cardinality constraints can be tightened (made more restrictive) in subtypes but never loosened. This ensures that any assumption valid for the supertype remains valid for all subtypes.
Valid Tightening Examples:
Supertype: EMPLOYEE ---ASSIGNED_TO(0..*)---> PROJECT
(employees can be assigned to any number of projects)
Subtype: INTERN ---ASSIGNED_TO(0..1)---> PROJECT
(interns can only be assigned to at most one project)
This is valid because 0..1 is a subset of 0..*. Any intern satisfies the supertype constraint while meeting the stricter subtype constraint.
Invalid Loosening (Prohibited):
Supertype: EMPLOYEE ---ASSIGNED_TO(1..3)---> PROJECT
(employees must be assigned to 1-3 projects)
Subtype: MANAGER ---ASSIGNED_TO(0..10)---> PROJECT
(INVALID: managers could have zero, exceeding max)
This violates the inheritance contract. Code expecting at least one project assignment for any Employee would break for Managers with zero projects.
Cardinality is enforced at the SUPERTYPE level, aggregated across all subtypes. If EMPLOYEE has a 'manages one project' cardinality, and an entity is both a Manager and Engineer (overlapping subtypes), that person still manages at most one project total—not one per subtype role. The cardinality sees the underlying EMPLOYEE, not the multiple subtype memberships.
Participation constraints (total vs. partial participation) also propagate through inheritance hierarchies, with nuanced behavior that reflects the semantic differences between these constraint types.
Total Participation Inheritance:
If a supertype has TOTAL participation in a relationship, all subtype instances MUST participate in that relationship. This is the stronger constraint and propagates absolutely.
EMPLOYEE ===WORKS_IN===> DEPARTMENT
(double line = total participation: every employee must work in a department)
For all subtypes (Manager, Engineer, Contractor):
There are no exceptions—the total participation is inherited fully.
Partial Participation and Subtype Strengthening:
If a supertype has PARTIAL participation, subtypes inherit the ability to participate but not the requirement. However, subtypes CAN strengthen this to total participation:
EMPLOYEE ---PARTICIPATES_IN---> TRAINING_PROGRAM
(single line = partial: not all employees are required to participate)
└── NEW_HIRE ===PARTICIPATES_IN===> TRAINING_PROGRAM
(strengthened to total: all new hires MUST participate)
This is valid because requiring participation is stricter than allowing it. Any NEW_HIRE that participates satisfies the EMPLOYEE constraint (which merely allows participation), and the NEW_HIRE-specific constraint ensures they all do participate.
Invalid Weakening:
EMPLOYEE ===REPORTS_TO===> MANAGER
(total: every employee must have a manager)
└── EXECUTIVE ---REPORTS_TO---> MANAGER
(INVALID: cannot weaken to partial)
If all Employees must report to someone, Executives (being Employees) cannot be exempted. To model executives who don't report to anyone, you'd need to restructure the hierarchy.
A common modeling challenge: 'All employees report to a manager, but the CEO reports to no one.' Solutions include: (1) Make the CEO report to themselves, (2) Create an EMPLOYEE_WITH_MANAGER subtype with total participation (excluding CEO), (3) Model reporting as partial and enforce 'most employees report' through application logic. Each has tradeoffs—the 'correct' solution depends on how strictly you interpret the domain rules.
While subtypes inherit all supertype relationships, they can also have their own local relationships that don't exist at the supertype level. This is the relationship equivalent of local attributes—associations that only make sense for a specific subtype.
When to Use Subtype-Specific Relationships:
PERSON (supertype)
├── Inherited by all: PERSON ---HAS---> CONTACT_INFO
EMPLOYEE (subtype of PERSON)
├── Inherited from PERSON: HAS CONTACT_INFO
├── Inherited by subtypes: EMPLOYEE ---WORKS_IN---> DEPARTMENT
├── Inherited by subtypes: EMPLOYEE ---EARNS---> SALARY_HISTORY
MANAGER (subtype of EMPLOYEE)
├── Inherited: HAS CONTACT_INFO (from PERSON)
├── Inherited: WORKS_IN DEPARTMENT (from EMPLOYEE)
├── Inherited: EARNS SALARY_HISTORY (from EMPLOYEE)
├── LOCAL: MANAGER ---SUPERVISES---> EMPLOYEE
├── LOCAL: MANAGER ---APPROVES---> EXPENSE_REPORT
ENGINEER (subtype of EMPLOYEE)
├── Inherited: All PERSON and EMPLOYEE relationships
├── LOCAL: ENGINEER ---CODES_IN---> PROGRAMMING_LANGUAGE
├── LOCAL: ENGINEER ---CONTRIBUTES_TO---> CODE_REPOSITORY
SALES_REP (subtype of EMPLOYEE)
├── Inherited: All PERSON and EMPLOYEE relationships
├── LOCAL: SALES_REP ---MANAGES---> CLIENT_ACCOUNT
├── LOCAL: SALES_REP ---EARNS---> COMMISSIONRelationship Count:
- PERSON: 1 relationship (HAS CONTACT_INFO)
- EMPLOYEE: 1 + 2 = 3 relationships
- MANAGER: 3 + 2 = 5 relationships
- ENGINEER: 3 + 2 = 5 relationships
- SALES_REP: 3 + 2 = 5 relationships
Key Observations:
- SUPERVISES only makes sense for MANAGER (not all employees supervise)
- CODES_IN only makes sense for ENGINEER (not managers or sales reps)
- MANAGES CLIENT_ACCOUNT is specific to sales domain
- All subtypes share the core WORKS_IN relationshipThis hierarchy demonstrates the principle that inherited relationships provide common ground while local relationships enable specialization. Each subtype has exactly the relationships it needs—no more, no less.
Relationship Placement Guidelines:
Placing relationships at the correct hierarchy level follows similar principles to attribute placement:
Place at Supertype Level When:
Place at Subtype Level When:
The Litmus Test:
"Can every instance of the supertype meaningfully participate in this relationship?"
If yes → define at supertype If no → define at the appropriate subtype(s)
If you find yourself defining the same relationship on multiple sibling subtypes, consider whether it belongs at the parent level. Just as with attribute inheritance, relationship duplication signals potential modeling improvements. Create intermediate types if needed to capture shared relationships without pushing them too high in the hierarchy.
Relationships often carry their own attributes—descriptive properties of the association itself, not of either participating entity. When relationships are inherited, these relationship attributes also propagate, with specific semantic implications.
Relationship Attribute Inheritance:
If a supertype relationship R has attributes {a, b, c}, subtype instances participating in R also have access to these attributes. The attributes describe the relationship instance, and since the relationship is inherited, so are its descriptive properties.
Example:
EMPLOYEE ---WORKS_IN---> DEPARTMENT
├── StartDate (when employment in department began)
├── EndDate (when employment ended, if applicable)
└── Role (the employee's role in that department)
All Employee subtypes inherit WORKS_IN with all three attributes:
| Scenario | Behavior | Example |
|---|---|---|
| Basic Inheritance | All relationship attributes are inherited | EMPLOYED_BY.StartDate available to all Employee subtypes |
| No Attribute Reduction | Cannot remove relationship attributes in subtypes | Cannot exclude EndDate for permanent employees |
| Constraint Strengthening | Attribute constraints can tighten in subtypes | Contractor.WORKS_IN.EndDate: NOT NULL (required) |
| Type Preservation | Data types and domains are preserved | Date remains Date, cannot change to String in subtype |
| Default Propagation | Default values propagate from supertype definition | Role DEFAULT 'Staff' applies to all subtypes |
Subtype-Specific Relationship Attributes:
When a subtype defines its own local relationship, it can specify relationship attributes that are unique to that association.
Example:
MANAGER ---SUPERVISES---> EMPLOYEE
├── Since (when supervision began)
├── EvaluationSchedule (performance review frequency)
└── MentoringFocus (specific area of mentorship)
SALES_REP ---MANAGES---> CLIENT_ACCOUNT
├── AssignmentDate
├── QuotaOverride (special quota for this account)
└── AccountTier (bronze, silver, gold)
These relationship attributes are entirely independent—MANAGES.QuotaOverride has no equivalent in SUPERVISES, and vice versa. Each relationship defines exactly the attributes that describe instances of that specific association.
Complex Scenario: Same Entity, Different Relationships:
Sometimes different subtypes relate to the same entity through different relationships with different attributes:
ENGINEER ---CONTRIBUTES_TO---> PROJECT
├── JoinDate
├── CodeLinesWritten
└── TechnicalRole (Backend, Frontend, etc.)
MANAGER ---OVERSEES---> PROJECT
├── AssignmentDate
├── BudgetResponsibility
└── StakeholderContact
An Engineer contributes code; a Manager oversees resources. Same PROJECT entity, but fundamentally different relationships with different semantics and different attributes.
A common modeling error is placing relationship attributes on entities. 'StartDate' for an Engineer working in a Department belongs to the WORKS_IN relationship, not to Engineer or Department. The date isn't a property of the engineer (they might work in multiple departments), nor of the department (which has many employees), but of the specific engineer-department association.
One of the most powerful consequences of relationship inheritance is polymorphic querying—the ability to traverse relationships at the supertype level while seamlessly including all subtype instances. This capability is essential for building flexible, maintainable applications.
The Power of Polymorphic Queries:
When you query an inherited relationship through the supertype, you automatically get results that include all subtype instances, without explicitly naming or knowing about those subtypes.
123456789101112131415161718192021222324252627282930313233
-- Setup: Department has many Employees (of various types)-- EMPLOYEE: supertype-- MANAGER, ENGINEER, ANALYST, INTERN: subtypes -- Polymorphic Query 1: Find all employees in Engineering department-- Returns Managers, Engineers, Analysts, Interns in EngineeringSELECT e.EmployeeId, e.Name, e.HireDateFROM Employee eJOIN Department d ON e.DepartmentId = d.DepartmentIdWHERE d.Name = 'Engineering'; -- Polymorphic Query 2: Count employees per department-- Counts ALL subtypes unified under EmployeeSELECT d.Name, COUNT(e.EmployeeId) as HeadCountFROM Department dLEFT JOIN Employee e ON e.DepartmentId = d.DepartmentIdGROUP BY d.Name; -- Polymorphic Query 3: Find departments without managers-- Treats managers just as employees with a subtypeSELECT d.NameFROM Department dWHERE NOT EXISTS ( SELECT 1 FROM Manager m WHERE m.DepartmentId = d.DepartmentId); -- Type-Specific Query: Find only engineers in Engineering-- Narrows to specific subtype when neededSELECT eng.EmployeeId, eng.Name, eng.ProgrammingLanguageFROM Engineer engJOIN Department d ON eng.DepartmentId = d.DepartmentIdWHERE d.Name = 'Engineering';Query Pattern Implications:
The Join Semantics:
When joining through an inherited relationship:
FROM Employee e JOIN Department d includes all subtypesPerformance Considerations:
Polymorphic queries may require the database to:
The specific performance profile depends on the physical mapping strategy (covered in a later page).
If most queries are polymorphic (need all subtypes), place relationships at the supertype level and optimize the physical mapping for supertype access. If most queries are subtype-specific, consider whether the relationship truly belongs at the supertype or should be pushed down to individual subtypes.
Real-world domains often present complex relationship inheritance scenarios that require careful analysis. Let's examine several common patterns and their solutions.
Scenario 1: Relationship Specialization
Sometimes a subtype needs a specialized version of a supertype relationship—same related entity, but different constraints or semantics.
Problem:
EMPLOYEE ---USES---> EQUIPMENT (partial, any equipment)
FIELD_ENGINEER needs: USES specific safety equipment (total, certified equipment only)
Solution Approaches:
Approach A: Strengthened Inherited Relationship
Approach B: Separate Subtype Relationship
Scenario 2: Role-Based Relationship Participation
An entity may participate in different relationships depending on which subtype role it inhabits.
Setup:
PERSON
├── STUDENT
└── FACULTY
COURSE ---TAKEN_BY---> STUDENT
COURSE ---TAUGHT_BY---> FACULTY
Challenge: A person who is both a STUDENT and FACULTY (e.g., PhD student who also teaches) participates in BOTH relationships.
Analysis:
Query Implications:
-- Find all courses a person is involved with (either taking or teaching)
SELECT c.CourseId, c.Name, 'Taking' as Role
FROM Course c JOIN Student s ON c.CourseId = s.TakenCourseId
WHERE s.PersonId = @personId
UNION
SELECT c.CourseId, c.Name, 'Teaching' as Role
FROM Course c JOIN Faculty f ON c.CourseId = f.TaughtCourseId
WHERE f.PersonId = @personId;
VEHICLE (supertype)
├── CAR
├── TRUCK
└── MOTORCYCLE
DRIVER (supertype)
├── PERSONAL_DRIVER
├── COMMERCIAL_DRIVER
└── TEST_DRIVER
Relationship: VEHICLE ---OPERATED_BY---> DRIVER
Additional constraint requirements:
- TRUCK can only be OPERATED_BY COMMERCIAL_DRIVER
- TEST_DRIVER can operate any VEHICLE
- PERSONAL_DRIVER can only operate CAR or MOTORCYCLEModeling Options:
Option A: Single Relationship + Application Constraints
- Define VEHICLE ---OPERATED_BY---> DRIVER at supertype level
- Enforce subtype compatibility in application logic
- Simple schema, complex enforcement
Option B: Multiple Specialized Relationships
- TRUCK ---OPERATED_BY_COMMERCIAL---> COMMERCIAL_DRIVER
- CAR ---OPERATED_BY_PERSONAL---> PERSONAL_DRIVER
- etc.
- Complex schema, declarative enforcement
Option C: Cross-Reference Table with Type Constraints
- Define VEHICLE_DRIVER_COMPATIBILITY entity
- Check constraint ensures valid combinations
- Most flexible, medium complexity
Recommendation: Option A for simple domains, Option C for complex
regulatory requirements where constraints must be database-enforced.When both relationship participants have hierarchies, the modeling decision depends on how strict the subtype-to-subtype constraints are and whether they need programmatic or declarative enforcement.
With S subtypes on one side and T subtypes on the other, you could theoretically need S × T specialized relationships. This explosion is usually unnecessary. Use inheritance at the supertype level and add constraints only where truly needed. Most subtype combination constraints can be enforced through CHECK constraints or triggers without creating separate relationships.
Relationship inheritance extends the power of EER hierarchies beyond attributes to encompass the associations between entities. Understanding how relationships propagate, how constraints flow, and when to use inherited vs. local relationships is essential for sophisticated data modeling.
What's Next:
With attribute and relationship inheritance covered, we now tackle one of the most challenging aspects of EER modeling: Multiple Inheritance. When a subtype extends more than one supertype, new complexities arise around attribute conflicts, relationship aggregation, and identity management. The next page explores these challenges and the strategies for resolving them.
You now understand how relationships flow through EER hierarchies—from basic propagation mechanics to complex scenarios involving dual hierarchies and role-based participation. This knowledge enables you to design schemas where relationships are defined at the right level, with appropriate constraints, supporting efficient polymorphic queries.