Generalization
Generalization is the opposite of specialization. It is the process of combining two or more lower-level entities into a higher-level entity (superclass) based on their common attributes.
- It answers the question: “What common entity can these subtypes belong to?”
- It is a bottom-up approach.
Key Points:
- Bottom-up approach (starts with specific entities and abstracts them into a generalized entity).
- Used when multiple entities share common attributes.
- Avoids redundancy by placing shared attributes in the generalized superclass.
Example
Suppose we have two entities:
Car→ attributes:Car_ID, Model, ColorBike→ attributes:Bike_ID, Model, Color
Both share common attributes: Model, Color.
Instead of keeping them separately with redundant attributes, we can create a generalized entity:
- Superclass → Vehicle (Vehicle_ID, Model, Color)
- Subclasses → Car, Bike
ER Representation (textual):
Car Bike
(Car_ID, ...) (Bike_ID, ...)
\ /
\ /
Vehicle
(Vehicle_ID, Model, Color)
Here, Generalization merges Car and Bike into a general entity Vehicle.
Difference Between Specialization and Generalization
| Aspect | Specialization | Generalization |
|---|---|---|
| Approach | Top-down (from general to specific) | Bottom-up (from specific to general) |
| Purpose | To create subtypes with distinct attributes | To merge common attributes into a single entity |
| Example | Employee → FullTime, PartTime | Car + Bike → Vehicle |
| Relationship type | “IS-A” (Employee is a FullTime) | “IS-A” (Car is a Vehicle) |