Specialization in DBMS: Definition, Examples and its Need
Specialization in DBMS: Definition, Examples and its Need: A simple Entity Relationship (ER) diagram represents the relationship of various entities which are stored in a database. Likewise, an Extended Entity Relationship (EER) diagram is an advanced version of ER diagram that manages the increasing complexity of the data. This extended ER diagram also introduced various concepts such as Specialization, Generalization, Aggregation, etc.
Also: Pagination in SQL Server, MySQL and Oracle with Examples
Specialization: Definition, Examples and its Need
Let us begin with learning Specialization in this tutorial.
Why is Specialization needed?
The ER models turned out to be more complex with large data and large databases. To deal with this Extended ER diagram came into the picture with many additional concepts among which specialization is one of the important features.
In general, an abstraction mechanism is used to remove the excess or unnecessary details of an object. For instance, details such as data storage, organization, and definition can be hidden from the user, and only necessary details like entities, attributes, and relationships can be exposed. Specialization is one such abstraction mechanism that deals with the complexity of the database.
Also: Structure of DBMS
Specialization Definition:
Specialization can be defined simply as a top-down approach of specializing a superclass or super-entity into two or more specific subclasses or sub-entities. Here, the sub-entities can have additional attributes. Nevertheless, it also inherits all the attributes from its parent entity.
Initially, the superclass is defined followed by the subclass with its related attributes and finally, the addition of relationship sets takes place. If you see the ER diagram, the realization is that there is a grouping of sub-entities that is distinct in some way from the other entities. For instance, one subset of the entity set may have a particular set of attributes that are not shared by another subset of entities in the entity set.
Also: Schedule in DBMS?
Explanation of Specialization with an example:
Consider an ER diagram above, it can be depicted as PERSON is a super-entity or a superclass having attributes like name, mobile number, and address. This person can be further classified either as an Employee or a student. In other words, Person IS-A Employee or Student. An EMPLOYEE now has an additional attribute called department (say name of a department to which he belongs), adding to this attribute, he also inherits super entity’s attributes like name, mobile number, and address by default. Likewise, a STUDENT entity is having an additional attribute as student id but it will also inherit all the super class’s attributes by default.
Furthermore, employees can be specialized into sub-entities like full-time, part-time or Adhoc. In other words, say an employee is working as a full-time employee or as a part-time employee, or as an Adhoc. As you can see above in the diagram, these sub-entities are further having additional attributes. Nevertheless, these also inherit the attributes from parent entities.
Also: Decomposition in DBMS
For instance, the FULLTIME subclass has its attribute as designation but will also inherit attributes from EMPLOYEE and PERSON entities. Likewise, a PARTTIME employee has attributes like number of days he works and task he is assigned but will also inherit attributes from both EMPLOYEE and PERSON. The sub-entity ADHOC has additional attribute hours but will also include fields from PERSON and EMPLOYEE. Lastly, STUDENT has a student_id attribute of its own, which includes attributes from PERSON only since PERSON is the only parent of STUDENT.
Some more examples are given below:
- In a company, the Employee is a superclass or a super-entity that can then function as either a Developer or a Tester based upon their role. Here Developer or Tester can be considered as the subclasses.
- Another example is an Employee – superclass yielding a set of subclasses like Salaried Employee or Hourly Employee based upon the method of Pay.
- A college can be classified as either a government or private university where college is superclass and government and private universities are the sub-entities that can have additional attributes.
Also: Serializability in DBMS
In summary, specialization in DBMS allows us to
- Define two or more subclasses for a superclass i.e., a super-entity.
- Addition of more attributes to the subclass.
- Establish relationships between subclass and other entities or other subclasses.
Leave a Reply