In this tutorial, We will study what is Entity Relationship Model in DBMS, and the components of the ER diagram – entity, attributes, relationships, keys, and cardinality. So let us start.
What is Entity Relationship Model in DBMS or ER Diagram?
ER diagram (Entity Relationship Model in DBMS) also known as the ER model is used for representing the data logically. It fulfills the requirement of the conceptual design of the database. It is used to represent relationships between different entity sets. The ER diagram looks more like a flowchart. But, ER Diagram contains many specialized symbols and the meanings of the symbols make this model unique. ER diagrams have meanings that should be thoroughly understood so that we can create correct diagrams.
What is an entity?
- An entity is an object, a component of data.
- An entity set is a collection of similar or like entities. For example, the set of rectangles.
- These entities have attributes that are used to define their properties.
- By defining the entities and their attributes a relationship is shown between them.
- An entity can be seen as an object with physical existence. For example- a car, a house, a city, a person, an employee, etc. Anything that has attributes is an entity.
- The entity is represented by a rectangle in the entity-relationship model.
- Entities are of two types- strong entities and weak entities.
- A strong entity can be uniquely identified by its own attributes. It always has a primary key. It is represented by a rectangle symbol.
- But a weak entity is an entity that needs to be defined by a foreign key relationship with a strong entity as it cannot be uniquely identified based upon its own attributes alone. It is represented by a double rectangle symbol. The entity is a part of Entity Relationship Model in DBMS.
What is an attribute?
- These are used to describe the entity.
- All the entities that are in the set have the same attributes.
- An attribute contains a single piece of information not a list of data.
- The minimal set of attributes that are needed to uniquely identify an entity is called a key. The attribute is a part of Entity Relationship Model in DBMS.
What are the types of attributes?
There are four types of attributes.
Those attributes can not be divided any further. Example: mobile phone number.
Those attributes can be further divided. For example name of a person, it can be divided into first name, middle name, and last name.
Those attributes are derived from other attributes. Example: experience can be derived from the date of joining.
Those attributes can have multiple values. For example, a person can have multiple mobile numbers and email ids.
In this figure student and course are the entities and studies are the relationship between the entities and attributes are name, roll no., class, course name, and course no.
What is the relationship?
- It is a bridge between two or more entities.
- Relationship set: The set of similar relationships.
- Recursive relationship: when an entity set participates more than once in a relationship.
- The entities in a relationship set must be able to identify the relationship.
- Attributes can not be used for identification. The relationship is a part of Entity Relationship Model in DBMS.
What is cardinality?
It is used to define the maximum number of relationships one entity can have with others. Cardinality is a part of Entity Relationship Model in DBMS. There are different types of cardinality like:
Many to many
One entity from A is associated with more than one entity from B and one entity from B is associated with more than one entity from A.
For example, Class as a group of students is associated with many faculty members, and many faculty members are associated with the class.
One to one
One entity from any entity set can be associated with another entity set B by at most one relation and vice versa.
For example, one employee can work only for one department and each department will have at most one employee.
One to many
One entity from entity set A might be associated with multiple entities of entity set B, but an entity from entity set B can be associated with at most one entity.
For example, one department might consist of multiple employees.
Many to one
One entity from entity set B can be associated with multiple entities of entity set A but every entity from entity set A will be associated with one or more than one entity from entity set B.
For example, many employees might belong to one department.
What is the degree of relationship?
The total number of various entity sets that are participating in a relationship set is called the degree of a relationship set. The degree is a part of Entity Relationship Model in DBMS.
When only one entity set is participating in relation. For example, a person can only marry a person.
When there are two entities that are participating in the relationship. For example, one student can go to only one school.
When there is n number of entities set that are participating in a relation.
What is Participation Constraint?
Participation Constraint is applied to the entity or entities participating in the relationship set. The participation constraint is a part of Entity Relationship Model in DBMS.
Each and every entity in the entity set must participate in the relationship. Total participation is represented by a double line. For example, every student is opting for a course therefore there is total participation from students.
Each and every entity in the relationship set need not participate in the relationship. Partial participation is shown by a single line. For example, every student might not be participating in every game.
What are the ER diagram notations?
ER- Diagram is the representation of data that describes how data is related to each other and defines the relationship between them. The ER diagram notations is a part of Entity Relationship Model in DBMS.
This symbol is used to represent the entity.
This Symbol is used to represent attributes.
This symbol represents the relationship types.
It helps in linking the attributes to entity types and entity types with other relationship types.
These attributes are underlined.
Used to represent multi-valued attributes.
I hope you live the What is Entity Relationship Model in DBMS: ER Diagram tutorial, Thanks for spending your time, Stay connected with us.