DBMS Generalization, Specialization, and Aggregation
DBMS Generalization
Generalization is a bottom-up
approach in which the common attributes of two or more lower-level entities combines
to form a new higher-level entity. In generalization, the generalized entity of
higher level can also combine with entities of the lower-level to make further
higher-level entity.
It is like a superclass and subclass system, but the only difference is that it
uses the bottom-up approach. It helps in reducing the schema size. It is always
applied to the group of entities and result in the formation of a single
entity.
According to the below diagram, there are two entities, namely
teacher and student. The teacher entity contains attributes such as teacher_id, name, and address and
student entity include student_id, name,
and address. Both entities can be combined to create a higher-level entity person. The address and name are common
to both the entities. The teacher entity has its attribute teacher_id, and the student
has its attribute student_id. The entities teacher and student are generalized
further into the person entity.
A lower-level entity is called a subclass, and the higher-level entity is
called a superclass. So, the person
entity is the superclass of two subclasses
teacher and student.
DBMS Specialization
It is opposite or inverse of generalization. A specialization is a top-down approach in which an entity of higher-level entity is broken down into two or more entities of lower level. In specialization, a higher-level entity set may not have any lower-level entity set. It is always applied to a single entity and results in the formation of multiple new entities. It increases the size of schema due to the increase in the number of entities.
In the below example, it can be seen that the employee is a high-level entity which is divided into three sub-entities (Ram, Shyam, and Mohan). The sub-entities are the names of the employees (relating to the high-level entity). Therefore, splitting a high-level entity into a low-level entity is called specialization.
DBMS Aggregation
Through the Entity-Relationship model, we cannot express a relationship set with another relationship set. Thus we use the concept of aggregation to express it.
Aggregation is an abstraction in which the relationship between two entities is treated as a higher-level entity. It allows you to indicate that a relationship set participates in another relationship set.
Example:
The student and program are two entity set and related
through a relationship set write. Suppose,
a student who writes any program must require a programming language installed
in their system. So, there will be another relationship set requires. You need to connect the relationship set requires with an entity set programming language and relationship
set write. But, we can connect only entity set to a relationship set.
One relationship set cannot be connected with another relationship set; for
this, we need aggregation. Here, the write
(relationship set) will treat like a higher-level
entity and can be associated with a relationship set requires. So, aggregation is needed when you express a
relationship set with another relationship set.