Specialization and Generalization in DBMS

Learn via video course
FREE
View all courses
DBMS Course - Master the Fundamentals and Advanced Concepts
DBMS Course - Master the Fundamentals and Advanced Concepts
by Srikanth Varma
1000
5
Start Learning
DBMS Course - Master the Fundamentals and Advanced Concepts
DBMS Course - Master the Fundamentals and Advanced Concepts
by Srikanth Varma
1000
5
Start Learning
Topics Covered

Specialization and Generalization are one of the most common concepts in DBMS. They are useful in organizing databases and help in reducing redundancy. In this article, we will briefly discuss them.

Generalization in DBMS

When someone says, "Social media", what comes to mind?

Facebook, Twitter, Instagram, or maybe LinkedIn

In short, if we want to talk about Social media in general, we generalize and refer to them as "Social Media". This method of combining multiple lower-level entities of a similar kind and referring to them as a single higher-level entity is what we know as generalizationgeneralization.

Generalization Characteristics:

  • The bottom-up technique is used for generalization.
  • It simplifies or generalizes the entities.
  • Higher-level entities and lower-level entities can be linked.

Let us take an example.

Let's say we have entities as mobile and laptop and we need to generalize it based on the common entities between them so before generalization, we will have two separate entities for mobiles and laptops.

Entities before Generalization

Below will be the entities before generalization:

Mobile Entity: Mobile entity can have attributes like mobile_ID, price, memory, battery, and dimension to which we can apply the generalization procedure.

Entities before Generalization

Laptop Entity: Laptop entity can have attributes like laptop_ID, price, memory, battery, and dimension to which we can apply the generalization procedure.

Laptop Entities

ER Diagram after Generalization

We can see that for laptops and mobiles, some attributes like price, memory, battery, and dimension are the same so we can apply generalization and can group them into an entity called Electronic Devices.

The Electronic DevicesElectronic\ Devices entity will have these common attributes and the laptop and mobile entity will be related to them using the "Is A" relationship table, so using generalization we can represent the ER diagram by:

ER Diagram

To know more about generalization, refer to this article.

Specialization in DBMS

A software developer is a person who can develop software. Now the software can be a web application, a mobile application, or, say, a desktop application. Hence, we can have developers specializing in a particular field, whether it's desktop applications, mobile applications, or desktop applications. This intuition of categorizing or dividing a higher-level entity into multiple lower-level entities of a similar kind is known as specializationspecialization.

Specialization Characteristics:

  • The top-down technique is used for specialization.
  • It divides or specializes in the entity.
  • Higher-level entities and lower-level entities can be linked.

Let us understand it with the help of an example.

Entities Before Specialization

Below are the entities before specialization:

Software Developer: Software developers can have attributes like name, age, salary, etc. We will apply specialization to this entity and will divide it into entities.

Entities befores Generalization

ER Diagram after Generalization

We can specialize the software developer entity into mobile developer entity and web developer entity.

Web Developer Entity: A web Developer entity can have attributes like name, age, salary, and sex and is obtained after applying specialization in a software developer entity.

Web developer Entity

Mobile Developer Entity: Mobile Developer entity can have attributes like name, age, salary, and sex and is obtained after applying specialization in software developer entity.

Specialization Mobile Entity

The ER diagram for the same is as follows:

ER Diagram for generalization

Difference between Generalization and Specialization in DBMS

The following are the key difference between generalization and specialization:

Specialization VS Generalization

GeneralizationSpecialization
Generalization is a bottom-up manner approachSpecialization is a top-down manner approach
Generalization collects the common features of multiple entities to form a new entity.Specialization divides an entity to form multiple new entities that inherit some feature of the splitting entity.
In Generalization, the higher-level entity must have lower-level entities.In Specialization, the higher-level entity may not have lower-level entities.
In Generalization, schema size reduces.In Specialization, schema size increases.
Generalization is applied to a group of entities.Specialization is applied to a single entity.
Generalization forms a single entity from multiple entities.Specialization forms multiple entities from a single entity.
Inheritance is not used in generalization.Inheritance can be used in specialization.
Generalization allows users to visualize bigger-picture patternsSpecialization allows users to narrow their search.

Read More:

Conclusion

  • Generalization is a bottom-up approach in which we combine multiple lower-level entities of a similar kind and refer to them as a single higher-level entity, allowing the user to see the bigger picture.
  • Specialization is a top-down approach in which we split a single entity into multiple entities, allowing the user to narrow down their search.
  • Generalization helps in reducing the schema size and is applied to a group of entities, whereas specialization is the exact opposite, i.e., it increases the schema size and is applied to a single entity.
  • To know more about DBMS topics, refer to this Article