Skip to content

The new BARC study is here

Download now

Enhanced Entity-Relationship Diagram: Concepts and Examples

Florian Wenzel
· · 10 mins read

An enhanced entity-relationship diagram (EER diagram) shows an ER model extended with subtype hierarchies, inheritance, and membership constraints. For example, a person may be an employee, a customer, both, or neither, depending on the modeled rules.

The worked example follows these memberships from business rules to a relational table design. It shows how to check the model’s assumptions and distinguish people from role memberships when counting records.

ER vs. EER: When to Use Each

Use a standard entity relationship diagram when entities, attributes, relationships, and participation rules adequately express the domain. Choose EER when the design needs explicit subtype hierarchies, inherited properties, or rules governing subtype membership.

Modeling requirementBasic ER modelEER model
Entities, attributes, and relationshipsRepresents these directlyRetains these constructs
Supertype and subtype identityHas no explicit subtype-inheritance constructRepresents “is-a” relationships between supertypes and subtypes
Inherited and subtype-specific propertiesDoes not define inheritance between entity typesDistinguishes inherited properties from attributes and relationships specific to a subtype
Subtype membership constraintsRequires additional rules beyond basic ER constructsExpresses disjoint or overlapping membership and total or partial specialization

For example, an Employee subtype can have attributes and relationships that apply specifically to employees. It also inherits the attributes and relationships of Person, preserving the distinction between shared properties and role-specific details.

Record count alone does not establish whether the design needs subtype hierarchies. For a relational implementation, map the EER model to tables and verify which rules the database or application enforces.

Core EER Concepts and Notation

I’d check whether someone can be both an employee and a customer, and whether they can be neither. Those answers tell you which membership rules the diagram needs.

Dirk Beerbohm, Global Partner Solution Architect, Exasol

Supertypes, subtypes, and inherited identity

A supertype, also called a superclass, defines attributes and relationships shared by its subtypes. A subtype, or subclass, represents a subset of the supertype’s entities and inherits those properties.

In our illustrative model, Employee inherits person_id from Person and represents the same individual in an employee role. Employee can add a role-specific attribute such as hire_date.

Weak entities express a different identification dependency. In this example, line_number is unique within its order. OrderItem uses (order_id, line_number) as its identifier. That line is a separate entity associated with Order, so the relationship does not express subtype inheritance.

Specialization, generalization, and membership rules

Specialization starts with a supertype and defines subtypes based on meaningful distinctions. Starting with Person, a designer can introduce Employee and Customer to capture role-specific attributes or relationships.

Generalization starts with entity types that share properties and identifies a common supertype. A designer considering Employee and Customer can identify shared person attributes and model them in Person. Both processes can lead to the same hierarchy.

Subtype membership can follow a defined condition or an explicit assignment. When an attribute of the supertype determines membership, it serves as a subtype discriminator. For user-defined subclasses, membership is assigned explicitly. For overlapping roles, membership rules must allow a person to belong to both Employee and Customer.

Shared subclasses and category unions

A shared subclass represents a subset of the intersection of its superclasses and inherits from each. For example, a shared subclass of Employee and Customer can contain selected people who hold both roles.

A category, or union type, represents a subset of the union of its defining entity types. For example, an Owner category could include selected Person and Company entities. A member must belong to at least one source type, without needing membership in every source type.

Read these constructs using the diagram’s stated notation. Hierarchy connectors and category symbols can differ across modeling conventions.

Try Exasol Personal for Free

Run real workloads at full Exasol performance.

Disjointness and Completeness Constraints

Disjointness determines whether subtype memberships may overlap. Completeness determines whether every supertype entity must belong to a subtype in the specialization.

Disjoint and overlapping subtype membership

A disjoint specialization allows each supertype entity to belong to at most one of the specified subtypes. An overlapping specialization permits membership in multiple subtypes, without requiring it.

For Person, Employee, and Customer, disjointness would prohibit someone from holding both roles. Overlapping membership allows that combination.

In the circle-based EER notation described by Elmasri and Navathe, d marks disjointness and o marks overlap.

Total and partial specialization

Total specialization requires every supertype entity to belong to at least one subtype in the specialization. Partial specialization permits a supertype entity to belong to none of those subtypes.

Partial specialization does not require some entities to remain outside all subtypes.

In the same notation, a double line from the supertype to the specialization circle indicates total specialization. A single line indicates partial specialization.

Four-combination matrix

The constraints combine independently. For a specialization containing only Employee and Customer under Person, the permitted memberships are:

SpecializationPermitted roles for each Person
Total and disjointEmployee only or Customer only
Partial and disjointNeither, Employee only, or Customer only
Total and overlappingEmployee only, Customer only, or both
Partial and overlappingNeither, Employee only, Customer only, or both

The worked example uses partial, overlapping specialization: a Person may be an Employee, a Customer, both, or neither.

Worked EER Example: People, Employees, and Customers

This illustrative example models individual people and their current employee and customer roles. It excludes company customers and historical role memberships.

Define the business rules and identifiers

Start with Person as the supertype and Employee and Customer as its subtypes. Apply these rules:

  • Each Person has a unique person_id. The full_name attribute is not required to be unique.
  • Employee and Customer inherit person_id and full_name from Person. Someone holding both roles retains the same identity across all three entity types.
  • Employee adds hire_date, while Customer adds customer_since.
  • Subtype membership is assigned explicitly. The date attributes describe the roles; their values do not independently determine membership.
  • A Person may belong to either subtype, both subtypes, or neither.

These rules specify a partial, overlapping specialization. In the selected notation, connect Person to a specialization circle with a single line and label the circle o. Connect that circle to Employee and Customer.

Enhanced entity-relationship diagram showing Person with Employee and Customer subtypes, using partial, overlapping specialization to allow either role, both roles, or neither.

Check the diagram against representative records

Use the following illustrative records to check whether the model permits each intended membership combination. The Yes and No values indicate subtype membership in this example, without prescribing how to store it.

person_idfull_nameEmployee membershipCustomer membership
101Avery MorganYesNo
102Blair ChenNoYes
103Casey PatelYesYes
104Drew RiveraNoNo

Casey’s membership in both subtypes tests the overlapping rule. Drew’s absence from both tests the partial rule. Avery and Blair confirm that either role can exist without the other.

Marking the specialization as disjoint would prohibit Casey’s valid combination. Marking it as total would require Drew to hold at least one role. Both changes would contradict the stated business rules.

An Employee or Customer instance without a corresponding Person would also violate the model. Every subtype member must retain its supertype membership, regardless of whether the specialization is partial or overlapping.

Mapping EER Hierarchies to Relational Tables

For the worked example, use a table for Person and a table for each subtype. The resulting database schema stores shared attributes in person and role-specific attributes in employee and customer.

Preserve identity with superclass and subtype tables

Use person_id as the primary key in all three tables. In each subtype table, it also serves as a foreign key referencing person.person_id.

TableColumnsLogical keys
personperson_id, full_namePrimary key: person_id
employeeperson_id, hire_datePrimary key: person_id; foreign key to person.person_id
customerperson_id, customer_sincePrimary key: person_id; foreign key to person.person_id

Store all four illustrative people in person. Employee membership produces rows for identifiers 101 and 103 in employee; Customer membership produces rows for 102 and 103 in customer.

Casey’s identifier, 103, appears in both subtype tables, while Casey’s name remains in person. Drew’s identifier, 104, appears only in person. This mapping accommodates both overlapping membership and people without either role.

Join a subtype table to person on person_id to retrieve its role-specific attributes alongside the shared name. These are logical key requirements; their enforcement must be checked in the chosen database system.

Compare alternative mapping choices

AlternativeFit for this exampleDesign consequence
One table with separate membership flagsSupports both overlapping and partial membershipUse independent is_employee and is_customer flags. Role-specific columns can be null when the corresponding role does not apply.
One table with an exclusive subtype labelAn Employee-or-Customer label cannot represent Casey’s simultaneous membershipsThat exclusive label would change the permitted membership combinations.
Subtype tables without a supertype tableCannot represent Drew, who belongs to neither subtypeRequires total subtype coverage. Casey’s shared attributes would also be repeated across the two subtype tables.

With separate membership flags, both flags would be true for Casey and false for Drew. The design would also need rules governing which role-specific values are permitted for each flag combination.

For this example, the separate-table mapping retains every Person, represents each role independently, and keeps shared attributes in one place.

Validating EER Rules and Analytical Counts

Validate which modeled rules the implementation enforces and what each analytical query counts. A correct hierarchy can still produce misleading totals when a query counts role memberships as people.

Separate modeled rules from enforced constraints

Review the SQL schema against the intended identifiers and relationships. Check for null or duplicate person_id values within each table and subtype identifiers without a matching Person.

In Exasol, primary and foreign key constraints can be enabled or disabled. The documentation on enabled and disabled constraints explains the distinction. For tables you own, inspect constraint enforcement status through EXA_USER_CONSTRAINTS.CONSTRAINT_ENABLED.

Test that the relevant enabled constraints reject duplicate identifiers and subtype rows without a corresponding Person. Also confirm that the implementation accepts Casey’s membership in both roles and Drew’s membership in neither.

The primary and foreign keys alone do not prohibit overlap or require every Person to have a subtype row. Those combinations are intentional in this model.

Count people and role memberships correctly

The following illustrative Exasol SQL requires the three mapped tables in the current schema, populated with the validated identifiers and memberships above. Use an account with schema access and permission to query all three tables. These queries have not been executed.

SELECT COUNT(*) AS total_people
FROM person;

SELECT
    COUNT(*) AS role_memberships,
    COUNT(DISTINCT person_id) AS people_with_roles
FROM (
    SELECT person_id FROM employee
    UNION ALL
    SELECT person_id FROM customer
) role_rows;

The first query counts Person rows, including people without either role. The second combines subtype rows with UNION ALL, preserving both memberships for someone who holds both roles. COUNT(DISTINCT person_id) then counts each identifier once across that combined population.

The expected counts for the illustrative records are:

MetricExpected count
Total people4
Role memberships4
People with at least one role3

Casey contributes two role memberships but one person with a role. Drew contributes to the total population but neither role-based metric.

Try Exasol Personal for Free

Run real workloads at full Exasol performance.

Frequently Asked Questions

An ER diagram represents entities, attributes, and relationships. An enhanced entity-relationship diagram (EERD) extends this model with supertypes, subtypes, inheritance, and constraints governing subtype membership.

UML, or Unified Modeling Language, supports modeling system structure and behavior through diagram types such as class and sequence diagrams. An ERD focuses on data entities, their attributes, and their relationships.

An EER diagram visualizes an enhanced entity-relationship model, including entity hierarchies, inherited properties, and subtype membership rules. For example, it can show Person with Employee and Customer subtypes and specify whether someone may hold both roles or neither.

An ERD is an entity-relationship diagram showing a data model’s entities, attributes, and relationships. For example, Customer and Order can be linked so each Customer may place multiple Orders and each Order belongs to one Customer.

Florian Wenzel
Florian Wenzel

As VP of Product Management at Exasol, Florian Wenzel is dedicated to developing products that customers love. His key responsibilities include aligning direct customer needs with innovative features to create impactful and strategic product roadmaps. Florian brings a wealth of experience to his role, having previously served as the Global Head of Solution Engineering. This position honed his deep understanding of diverse use cases and equipped him with extensive expertise in database technologies—an area he has thoroughly explored during his PhD studies. With a strong foundation in customer-focused product development and technical proficiency, Florian continues to drive Exasol’s mission to deliver outstanding database solutions.