A Complete Guide to EER Concepts, Specialization, Generalization, and Categories
Enhanced Entity-Relationship Model Fundamentals
EER stands for Enhanced ER (also called Extended ER). It extends the basic ER model by adding additional modeling concepts that were difficult to represent in traditional ER diagrams.
The traditional ER Model concepts were insufficient for modeling complex data in modern database applications. EER incorporates extensions to handle:
Represents meaningful subgroupings of entities with inherited and specific attributes
Top-down and bottom-up approaches to creating class hierarchies
Subclasses with multiple superclasses from different entity types
These EER concepts improve the expressive power of ER diagrams and enable us to design very complex database applications that accurately model real-world scenarios.
Understanding Entity Hierarchies and IS-A Relationships
An entity type may have additional meaningful subgroupings of its entities that are important to the organization. These subgroupings are called subclasses or subtypes.
The EMPLOYEE entity can be grouped into subclasses based on different criteria:
The general entity type (e.g., EMPLOYEE) that contains all entities
A subset of the superclass with specific characteristics (e.g., SECRETARY)
Subclass IS-A Superclass (e.g., SECRETARY IS-A EMPLOYEE)
An entity that is a member of a subclass inherits:
SECRETARY (and TECHNICIAN and ENGINEER) inherit attributes like:
SECRETARY also has its own specific attribute:
Typing_speed (not applicable to other employee types)A member of the superclass can be optionally included as a member of any number of its subclasses:
Top-Down Approach to Defining Subclasses
Specialization is the process of defining a set of subclasses of a superclass. The set of subclasses is based upon some distinguishing characteristics of the entities in the superclass.
Specialization is a top-down design process:
A superclass may have several specializations based on different distinguishing characteristics. For example, EMPLOYEE can have:
If all subclasses in a specialization have their membership condition based on the same attribute of the superclass, the specialization is called an attribute-defined specialization.
This attribute is called the defining attribute or discriminator.
Job_type is the defining attribute (discriminator) of the specialization {SECRETARY, TECHNICIAN, ENGINEER} of EMPLOYEE
A specialization hierarchy is a structure where every subclass participates as a subclass in only one superclass relationship (single inheritance). This creates a tree-like structure.
Bottom-Up Approach to Creating Superclasses
Generalization is the process of generalizing entities which contain common attributes into a higher-level entity (superclass). It defines a general entity type from a set of specialized entity types.
Generalization is a bottom-up design process:
Generalization is usually TOTAL because when you generalize from existing entity types, every entity in those types must be included in the resulting superclass - all entities participate in the generalization by definition.
The resulting structures from specialization and generalization are structurally equivalent. The difference is primarily in the design process and perspective:
Rules Governing Subclass Membership
Two basic constraints can apply to specialization and generalization:
These constraints are independent of each other.
Subclasses must be disjoint
d in EER diagramSame entity can be in multiple subclasses
o in EER diagramEvery entity must belong to a subclass
Entity may not belong to any subclass
Entity in exactly one subclass
Entity in at most one subclass
Entity in one or more subclasses
Entity in zero or more subclasses
Certain insertion and deletion rules apply as a result of these constraints:
d = Disjoint (in circle)o = Overlapping (in circle)━━ = Total (double line)── = Partial (single line)
Subclasses with Multiple Different Superclasses
A category (or UNION type) is a subclass that has several possible superclasses, where each superclass represents a different entity type.
The category represents a collection of entities that is a subset of the UNION of the entities of distinct entity types.
Regular Specialization/Generalization: Subclasses share the same superclass
Category (UNION Type): A single subclass with multiple different superclasses
Categories are needed when modeling a single superclass/subclass relationship with more than one superclass where the superclasses represent different types of entities.
Attribute inheritance works more selectively in categories:
Holds the union of ALL entities in its superclasses
Holds a subset of the union of entities
The superclasses of a category may have:
Use Specialization/Generalization when:
Use Categorization (UNION type) when:
Note: For total categories, the choice can be subjective as they may be represented alternatively as total specialization.
Key Takeaways from EER Modeling
Extends basic ER to handle complex hierarchies, subgroupings, and inheritance that traditional ER cannot express
Subclasses inherit all attributes and relationships from superclasses, plus add their own specific features
Top-down approach: Define subclasses from a superclass based on distinguishing characteristics
Bottom-up approach: Create a superclass from entity types by identifying common features
Disjointness (d/o) and Completeness (total/partial) control subclass membership independently
UNION types allow subclasses with multiple different superclasses using selective inheritance
With EER concepts mastered, we can now create logical designs and dive into the relational model - translating these conceptual designs into actual database schemas.
All EER concepts - superclasses/subclasses, specialization/generalization, and categories - improve the expressive power of ER diagrams and enable us to design very complex database applications that accurately model real-world scenarios.