Javatpoint Logo
Javatpoint Logo

Enhanced ER Model

ER Diagram

ER diagram stands for Entity Relationship diagram. When we draw the relationships between entities using a diagram, then it is called an entity relationship diagram. The ER diagram is just for understanding the purpose of the database administrator. We cannot use the ER diagram directly on the computer. ER diagrams are converted into the tabular form then they are inserted into the computer using any query language. In ER diagrams, we use attributes, entities, and the relationships between entities. We use an oval shape to represent the entity and a diamond shape to represent the relationships between entities.

Enhanced ER Diagram

It is getting harder and harder to apply the conventional ER paradigm for database modeling as data complexity rises today. The existing ER model needs to be enhanced or improved in order for it to better handle the complicated application in order to reduce the modeling complexity.

The requirements and complexity of complicated databases are represented using enhanced entity-relationship diagrams, which are sophisticated database diagrams very similar to standard ER diagrams.

The SubClass and SuperClass, Specialization and Generalization, Union or Category, Aggregation, etc., are displayed using this diagrammatic style.

  • Generalization and Specialization

These are two normal kinds of relationships that were added to the normal ER model for enhancement. These are inspired by the object-oriented paradigm, where we divide the code into classes and objects, and in the same way, we have divided entities into subclass and superclasses. Specialized classes are called subclasses, and generalized classes are called superclasses or base classes. We can learn the concept of subclass by 'IS-A' analysis. For example, 'Laptop IS-A computer.' Or 'Clerk IS-A employee.'

In this relationship, one entity is a subclass or superclass of another entity. For example, in a university, a faculty member or clerk is a specialized class of employees. So an employee is a generalized class, and all others are its subclass.

We can draw the ER diagram for these relationships. Let's suppose we have a superclass Employee and subclasses as a clerk, engineer, and lab assistant.

Enhanced ER Model

The Enhanced ER diagram of the above example will look like this:

Enhanced ER Model

In the above example, we have one superclass and three subclasses. Each subclass inherits all the attributes from its superclass so that a lab assistant will have all its attributes, like its name, salary, etc.

Constraints

There are two types of constraints on subclasses which are described below:

  • Total or Partial:

A total subclass relationship is one where the union of all the subclasses is equal to the superclass. It means if every superclass entity has some subclass entity, then it is called a total subclass relationship. Let's suppose if the union of all the subclasses ( engineer, clerk, lab assistant) is equal to the total employee. Then the relationship is total. In the above example, it is a total relationship.

If all the entities of a superclass are not associated with a subclass, then it is called a partial subclass relationship.

  • Overlapped or Disjoint:

If any entity from the superclass is associated with more than one subclass, then it is known as overlapped subclassing, and if it is associated with zero or only one subclass, then it is called disjoint subclassing.

Note: The above two constraints are independent of each other, and they follow the transitive property.

Multiple Inheritance

When one subclass is associated with more than one superclass, then this phenomenon is known as multiple inheritance. In multiple inheritance, the attributes of the subclass will be the union of all the superclass attributes which are associated with it. For example, a teacher is a subclass that can be associated with the superclass of an employee and a superclass of faculty. In the same way, a monitor in the class can be a subclass of a student superclass as well as an alumni superclass.

UNION

UNION is a different topic from subclassing. Let's suppose we have a vehicle superclass, and we have two subclasses, car and bike. These two subclasses will inherit the attributes from the vehicle superclass.

Now we have a UNION of those vehicles which are RTO registered, so we have a UNION of cars and bikes, but they will inherit all the attributes from the vehicle superclass.







Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA