Difference Between ER and EER Diagram

The key difference between ER and EER diagram is that the ER diagram is a visual representation of data based on ER model, and it describes how entities are related to each other in the database. EER diagram is a visual representation of data, based on EER model that is an extension of the original entity-relationship (ER) model.

Before entering the data into the database, the database should be designed. The ER diagram is used to design the database. It is based on the Entity-relationship model. The Entity relationship model is a model used to design and represent the relationships between data. With the complexity of data, the ER model was developed further. It is known as the Enhanced ER Model. The EER diagram is based on the Enhanced ER Model.

CONTENTS

1. Overview and Key Difference
2. What is ER Diagram
3. What is EER Diagram
4. Similarities Between ER and EER Diagram
5. Side by Side Comparison – ER vs EER Diagram in Tabular Form
6. Summary

What is ER Diagram?

The ER diagram represents the relationship between different entities. The entities, attributes and relationships are common components of an ER diagram. An entity is a real-world object. In a School database, there can be entities such as Student, Lecturer, Course etc. If Student is an entity, the whole dataset of Student is called an entity set. Some entities might depend on another entity. That kind of entity is known as a weak entity.

The entities are related to each other with relationships. When one instance of the entity is associated with one instance of another entity, it is called one to one relationship. There is one manager for a department. So, it is a 1:1 relationship.  When one instance of an entity is associated with many instances of another entity, it is known as one to many (1:M) relationship. In a department, there can be multiple employees, but an employee is in one department. So, it is 1:M relationship. When many instances of an entity are associated with many instances of another entity, it is called as one to many (M: N) relationship. An employee can work on multiple projects. Also, there can be multiple employees on one project. It is a M: N relationship. The 1:1, 1:M and M: N are binary relationships. When an entity is related to itself, it is a recursive relationship.  Relationship of degree three is a ternary relationship.

Each entity has properties that describe them. They are known as attributes. The Student entity can have attributes such as student_id, name, date_of_birth, telephone number. Each entity contains a key attribute which helps to differentiate each record in the database. In Student entity, the student_id can be considered as the key attribute because it helps to identify each read uniquely. Some attributes can be derived from other attributes. The age attribute can be derived by the data_of_birth attribute. Therefore, age is a derived attribute. If the Student has multiple telephone numbers, the telephone_number attribute can be considered as a multivalued attribute.  The name attribute can be divided into multiple attributes such as first name and last_name. Then it is a composite attribute.

Refer the below ER diagram,

Figure 01: ER Diagram

The Lecturer is an entity. It has id and speciality attributes. The id is the key attribute. The lecturer conduct course. The conduct is the relationship between Lecturer and Course. A relationship is denoted by a diamond shape. The key attribute of the Course entity is course code. A Project depends on the Course. Therefore, the Project is a weak entity. The relationship between Course and Project is also weak. A weak entity is represented by some double rectangular boxes. The Project is done by Student. The key attribute of Student is id. The student can have multiple phones, so it is a multi-valued attribute. The name attribute is further divided into firstname and lastname. So, the name is a composite attribute.

The Lecturer conducts many courses, and the Lecturer supervises many projects, so they are one to many (1:M) relationship. One Course has one Project, and a project is done by one student. Therefore, they are one to one (1:1) relationships.

What is EER Diagram?

When the application became complex, the tradition ER model was not enough to draw a sophisticated diagram. Therefore, the ER model was developed further. It is known as the Enhanced ER diagram. There are three concepts added to the existing ER model in the Enhanced ER diagram (EER). Those are generalization, specialization and aggregation. In generalization, the lower level entities can be combined to produce a higher-level entity. The specialization is the opposite of generalization. In specialization, the high-level entities can be divided into lower level entities. Aggregation is a process when the relation between two entities is a treated as a single entity.

Figure 02: Generalization and Specialization

According to the above ER diagram, the Student and Lecturer entities are Person entities. When going from bottom to top, generalizes the Student and Lecturer entities to Person entity. It is the bottom up approach. When going from top to bottom, the Person entity can be further specialized into Student and Lecturer. It is the top down approach. The name and city attributes of Person belongs to Student entity a Lecturer entity. The Student entity has its own student_id attribute, and Lecturer entity has its lecturer_id.

An example of aggregation is as follows.

Figure 03: Aggregation

According to the above ER diagram, the relationship between Exam Center and Exam together act as an entity. This whole entity is in a relationship with the Student entity. When the Student visits the Exam centre, he or she will inquire about both the centre and the exam. Therefore, when the relation between two entities is treated as a single entity, it is an aggregation.

What is the Similarity Between ER and EER Diagram?

  • Both ER and EER diagrams can be used to design databases.

What is the Difference Between ER and EER Diagram?

ER vs EER Diagram

ER diagram is a visual representation of data based on ER model, and it describes how entities are related to each other in the database. EER diagram is a visual representation of data, based on EER model that is an extension of the original entity-relationship (ER) model.
 Model
ER diagram is based on ER model. EER diagram is based on EER model.

Summary – ER vs EER Diagram

A database can be designed using an ER diagram. EER diagram is an enhanced ER diagram. There are additional features in EER than the original ER diagram. ER diagram is a visual representation of data based on ER model, and it describes how entities are related to each other in the database. EER diagram is a visual representation of data, based on EER model that is an extension of the original entity-relationship (ER) model. That is the difference between ER and EER diagram.

Reference:

1.“Working with ER Diagrams.” Creating ER Diagram Representation in DBMS | Studytonight. Available here
2. “The Enhanced ER Model.” Generalization, Specialization and Aggregation in ER Model | Studytonight. Available here