The Entity-Relationship (ER) Model is predicated on the idea of actual entities and their interrelationships.
The Entity Relationship Model (ER Model) generates entity sets, relationship sets, general characteristics, and constraints by incorporating real-world scenarios into the database model.
The ER Model works best when applied to a database’s conceptual design.
ER Model in DBMS is based on
Entities and their attributes.
Relationships among entities.
Table of Contents
Entity:
A real-world entity with properties referred to as attributes is called an entity in an ER model.
Each property is identified by its domain, or collection of values.
For instance, a student is regarded as an entity in a school database. The characteristics of a student include name, age, class, etc.
Strong Entity:
Strong entities in the schema are independent of one another.
A powerful creature consistently possesses a primary key.
One rectangle is used to symbolize strong entities.
One diamond represents the relationship between two powerful entities.
Weak Entity:
To survive, a weak entity depends on a powerful entity.
Unlike strong entities, weak entities do not have a primary key.
A double rectangle is used to indicate a weak entity.
A double diamond symbolizes the relationship between one strong and one weak entity.
Attributes:
Attributes are the properties of entities.
Ellipses are used to symbolize attributes.
Each ellipse denotes a single property and is associated with a rectangle, which is its entity.
Key Attribute:
An entity from an entity collection can be uniquely identified by its key attribute.
A student can be uniquely identified from a group of students using their student roll number, for instance.
Similar to other characteristics, the key attribute is represented by an oval, but its content is highlighted.
Composite Attribute:
When attributes are composite, they are represented by a hierarchical structure akin to a tree.
Each link is then linked to its corresponding attribute.
In other words, ellipses joined by ellipses indicate composite qualities.
Multivalued Attributes:
More than one value
We depict multivalued attributes with a double ellipse.
Derived Attributes:
This attribute is derived from another attribute.
We depict derived attributes with a dashed ellipse.
Relationship
Relationships are the result of logical associations between things.
Many mappings exist between relationships and entities.
Defining the number of associations between two things is done by mapping cardinalities.
Mapping cardinalities:
One to One
One to Many
Many to One
Many to Many
Participation Constraints:
Total Participation − Each entity is involved in the relationship. Double lines represent total participation.
Partial participation − Not all entities are involved in the relationship. Single lines represent partial participation.
Additional Features of the ER Model:
Generalization:
The ER Model allows for a hierarchical representation of database entities.
Generalization refers to moving ahead in this hierarchy.
To portray a broader perspective, entities are combined.
Specialization:
Specialization is the reverse of generalization.
In specialization, a collection of things is separated into sub-groups depending on their features.
Inheritance:
One crucial aspect of generalization and specialization is inheritance.
It permits attributes from higher-level entities to be inherited by lower-level entities.
Aggregation:
Aggregation occurs when two separate entities combine to form a unified whole because neither entity can understand their relationship independently.
Conceptual Design with ER Model:
Creating an ER diagram offers several options, such as these:
Is it better to model an idea as a property or entity?
Is it better to model an idea as a relationship or entity?
Which entity sets participate in the relationship sets? Is it better to employ ternary or binary relationships?