Generalization
Generalization is the process of extracting common properties from a set of entities and creating
a generalized entity from it. It is a bottom-up approach in which two or more entities can be
generalized to a higher-level entity if they have some attributes in common.
Example: STUDENT and FACULTY can be generalized to a higher-level entity called
PERSON as shown in diagram below. In this case, common attributes like P_NAME and
P_ADD become part of a higher entity (PERSON) and specialized attributes like S_FEE become
part of a specialized entity (STUDENT).
Specialization
In specialization, an entity is divided into sub-entities based on its characteristics. It is a top-
down approach where the higher-level entity is specialized into two or more lower-level entities.
Example: an EMPLOYEE entity in an Employee management system can be specialized
into DEVELOPER, TESTER, etc. In this case, common attributes like E_NAME, E_SAL, etc.
become part of a higher entity (EMPLOYEE) and specialized attributes like TES_TYPE become
part of a specialized entity (TESTER).
Inheritance
It is an important feature of generalization and specialization. In specialization, a higher-level
entity is divided into lower-level sub-entities that inherit its attributes. In generalization, similar
lower-level entities are combined into a higher-level entity that holds common attributes. In both
cases, inheritance allows sub-entities to reuse the properties of the parent entity.
1. Attribute inheritance: It allows lower level entities to inherit the attributes of higher level
entities and vice versa. In diagram Car entity is an inheritance of Vehicle entity ,So Car can
acquire attributes of Vehicle. Example: Car can acquire Model attribute of Vehicle.
2. Relationship Inheritance: Sub-entities also inherit relationships of the parent entity.
3. Overriding Inheritance: Sub-entities can override or add their own attributes or behaviors
different from the parent.
4. Participation inheritance: Participation inheritance in ER modeling refers to the inheritance of
participation constraints from a higher-level entity (superclass) to a lower-level entity (subclass).
It ensures that subclasses adhere to the same participation rules in relationships, although
attributes and relationships themselves are inherited differently.
Example: In diagram Vehicle entity has an relationship with Cycle entity, but it would not
automatically acquire the relationship itself with the Vehicle entity. Participation inheritance only refers
to the inheritance of participation constraints, not the actual relationships between entities.
Combining Specialization and Generalization
Specialization and generalization are applied within the same database design. These two
processes are not mutually exclusive; they are complementary.
Consider the university database. Let's see how specialization and generalization are applied
here –
Specialization − The PERSON entity type is specialized into STUDENT, EMPLOYEE,
and ALUMNUS. EMPLOYEE is further divided into FACULTY, STAFF, and
STUDENT_ASSISTANT.
Generalization − FACULTY and STAFF are generalized into EMPLOYEE.
By combining these processes, designers can make a more structured and accurate representation
of the data.
Advantages of Specialization and Generalization
Data Organization − Ensures logical grouping of attributes and relationships, making
the database easier to manage.
Flexibility − Accommodates both unique and shared characteristics of entities.
Efficiency − Reduces redundancy by storing shared attributes in a superclass.
Real-World Representation − Mirrors how entities are structured in real life.
Aggregation
An ER diagram is not capable of representing the relationship between an entity and a
relationship which may be required in some scenarios.
In those cases, a relationship with its corresponding entities is aggregated into a higher-
level entity.
Aggregation is an abstraction through which we can represent relationships as higher-
level entity sets.
Example: an Employee working on a project may require some machinery. So, REQUIRE
relationship is needed between the relationship WORKS_FOR and entity MACHINERY. Using aggregation,
WORKS_FOR relationship with its entities EMPLOYEE and PROJECT is aggregated into a single entity and
relationship REQUIRE is created between the aggregated entity and MACHINERY.
The Enhanced Entity Relationship Model contains all the features of the Entity Relationship
model. In addition to all that, it also contains features of Subclasses, Superclasses and
Inheritance.
All of these in detail are as follows −
Subclasses
A subclass is a class derived from the superclass. It inherits the properties of the superclass and
also contains attributes of its own. An example is:
Superclasses
A superclass is the class from which many subclasses can be created. The subclasses inherit the
characteristics of a superclass. The superclass is also known as the parent class or base class.
In the above example, Vehicle is the Superclass and its subclasses are Car, Truck and
Motorcycle.
Inheritance
Inheritance is basically the process of basing a class on another class i.e to build a class on a
existing class. The new class contains all the features and functionalities of the old class in
addition to its own.
The class which is newly created is known as the subclass or child class and the original class is
the parent class or the superclass.
Weak Entity Set in ER diagrams
The entity sets which do not have sufficient attributes to form a primary key are known as weak entity
sets and the entity sets which have a primary key are known as strong entity sets.
Weak entity is depend on strong entity to ensure the existence of weak entity. Like strong entity, weak
entity does not have any primary key, It has partial discriminator key. Weak entity is represented by
double rectangle. The relation between one strong and one weak entity is represented by double
diamond