In this tutorial, We will study about the ER diagram, components of the ER diagram - entity, attributes, relationships, keys, and cardinality. So let us start.
ER diagram 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.
There are four types of attributes.
Those attributes that can not be divided any further. Example: mobile phone number.
Those attributes can be further divided. Example: name of a person, it can be divided into first name, middle name, and last name.
Those attributes that are derived from other attributes. Example: experience can be derived from the date of joining.
Those attributes can have multiple values. Example: a person can have multiple mobile numbers and email ids.
In this figure student and course are the entities and studies is the relationship between the entities and attributes are name, roll no., class, course name and course no.
It is used to define the maximum number of relationships one entity can have with others. There are different types of cardinality like:
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 entity from any entity set can be associated with another entity set B by at most on relation and vice versa.
For example, one employee can work only for one department and each department will have at most one employee.
One entity from entity set A might be associated with multiple entities of the entity set B, but an entity from the entity set B can be associated with at most one entity.
For example, one department might consist of multiple employees.
One entity from the entity set B can be associated with multiple entities of the entity set A but every entity from the entity set A will be associated with one or more than one entity from the entity set B.
For example, many employees might belong to one department.
The total number of various entity sets that are participating in a relationship set is called the degree of a relationship set.
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.
Participation Constraint is applied to the entity or entities participating in the relationship set.
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.
ER- Diagram is the representation of data that describes how data is related to each other and defines the relationship between them.
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.