Oose First Unit
Oose First Unit
Introduction of ER Model:
The Entity Relationship Model is a model for identifying entities to be represented
in the database and representation of how those entities are related.
Peter Chen developed the ER diagram in 1976. The ER model was created to
provide a simple and understandable model for representing the structure and logic
of databases. It has since evolved into variations such as the Enhanced ER Model
and the Object Relationship Model.
The Entity Relationship Diagram explains the relationship among the entities
present in the database. ER models are used to model real-world objects like a
person, a car, or a company and the relation between these real-world objects. In
short, the ER Diagram is the structural format of the database.
The Entity Relationship Diagram explains the relationship among the entities
present in the database. ER models are used to model real-world objects like a
person, a car, or a company and the relation between these real-world objects. In
short, the ER Diagram is the structural format of the database.
Why Use ER Diagrams?
What is Entity?
An Entity may be an object with a physical existence – a particular person,
car, house, or employee – or it may be an object with a conceptual
existence – a company, a job, or a university course. Entities refer to
tables used in databases. Entity Type is represented as
What is Attribute?
Attribute are the properties that define the entity type. For example,
RollNo, Name, DOB, Age, Address, and MobileNo are the attributes that
define entity type Student. In ER diagram, the attribute is represented by
an oval.
Types of Attributes:
1. Key Attribute
The attribute which uniquely identifies each entity in the entity set is called the
key attribute. For example, Roll_No will be unique for each student. In ER diagram,
the key attribute is represented by an oval with underlying lines.
2. Composite Attribute
An attribute composed of many other attributes is called a composite attribute.
For example, the Address attribute of the student Entity type consists of Street,
City, State, and Country. In ER diagram, the composite attribute is represented by
an oval comprising of ovals.
3. Multivalued Attribute
An attribute consisting of more than one value for a given entity. For example,
Phone_No (can be more than one for a given student). In ER diagram, a
multivalued attribute is represented by a double oval.
4. Derived Attribute
An attribute that can be derived from other attributes of the entity type is known as
a derived attribute. e.g.; Age (can be derived from DOB). In ER diagram, the
derived attribute is represented by a dashed oval.
The Complete Entity Type Student with its Attributes can be represented
as:
Relationship:
Types of Relationships:
Attributes on Relationships:
Cardinality:
Specifies the number of instances of an entity that can be associated with another
entity.
Represented using numbers (e.g., 1, N) or notation like "Crow’s Foot."
Extended Features of E-R Diagram:
Generalization, Specialization and Aggregation in
ER Model
Using the ER model for bigger data creates a lot of complexity while
designing a database model, So in order to minimize the complexity
Generalization, Specialization, and Aggregation were introduced in the ER
model. These were used for data abstraction. In which an abstraction
mechanism is used to hide details of a set of objects. In this article we will
cover the concept of Generalization, Specialization, and Aggregation with
example.
Generalization
Generalization is the process of extracting common properties from a set
of entities and creating a generalized entity from it. It is a bottom-up
approach in which two or more entities can be generalized to a higher-
level entity if they have some attributes in common. For Example,
STUDENT and FACULTY can be generalized to a higher-level entity
called PERSON as shown in Figure 1. In this case, common attributes like
P_NAME, and P_ADD become part of a higher entity (PERSON), and
specialized attributes like S_FEE become part of a specialized entity
(STUDENT).
Generalization is also called as ‘ Bottom-up approach”.
Specialization
In specialization, an entity is divided into sub-entities based on its
characteristics. It is a top-down approach where the higher-level entity is
specialized into two or more lower-level entities. For Example, an
EMPLOYEE entity in an Employee management system can be
specialized into DEVELOPER, TESTER, etc. as shown in Figure 2. In this
case, common attributes like E_NAME, E_SAL, etc. become part of a
higher entity (EMPLOYEE), and specialized attributes like TES_TYPE
become part of a specialized entity (TESTER).
Specialization is also called as ” Top-Down approch”.
Aggregation:
Aggregation in an Entity-Relationship Diagram (ERD) is a concept used to
model a situation where a relationship itself becomes an entity, allowing it to
participate in another relationship. It provides a higher level of abstraction by
treating a relationship as a single unit that can be connected to other entities or
relationships.