intro to er model
intro to er model
ER model in DBMS is the high-level data model. It stands for the Entity-relationship model and is
used to represent a logical view of the system from a data perspective. In simple words, the entity
relationship diagram is a blueprint that can used to create a database. E-R diagrams are used to model
real-world objects like a person, a car, a company and the relation between these real-world objects.
WHAT IS ER-DIAGRAM?
ER-Diagram is a pictorial representation of data that describes how data is communicated and related
to each other.
Components of ER Diagram:
1. ENTITIES
It is a real-world thing which can be a person, place, or even a concept. For Example: Department,
Admin, Courses, Teachers, Students, Building, etc are some of the entities of a School Management
System.
Entities are of two types:
Strong Entity – A strong entity is an entity type that has a key attribute. It doesn't depend on other
entities in the schema. A strong entity always has a primary key, and it is represented by a single
rectangle in the ER diagram.
Weak Entity-An entity that depends on another entity called a weak entity. The weak entity doesn't
contain any key attribute of its own. The weak entity is represented by a double rectangle.
2. ATTRIBUTES
An entity which contains a real-world property called an attribute. For Example: The entity employee
has the property like employee id, salary, age, etc.
Following is the Attributes of an Entity
o Simple Attribute:
It is also known as atomic attributes. When an attribute cannot be divided further, then it is called a
simple attribute.
For example, in a student table, the age attribute cannot be further divided. It is called a simple or
atomic attribute because it contains only a single value that cannot be broken further.
o Composite Attribute:
Composite attributes are those that are made up of the composition of more than one attribute. When
any attribute can be divided further into more sub-attributes, then that attribute is called a composite
attribute.
For example, in a student table, we have attributes of student names that can be further broken down
into first name, middle name, and last name. So the student name will be a composite attribute.
Another example from a personal detail table would be the attribute of address. The address can be
divided into a street, area, district, and state.
o Single-valued Attribute:
Those attributes which can have exactly one value are known as single valued attributes. They
contain singular values, so more than one value is not allowed.
For example, the Age of a student can be a single valued attribute. Another example is gender
because one person can have only one gender.
o Multi-valued Attribute:
Those attributes which can have more than one entry or which contain more than one value are called
multi valued attributes.
In the Entity Relationship (ER) diagram, we represent the multi valued attribute by double oval
representation.
For example, the hobbies of a person because one can have more than one hobby, so that it would be
a multi valued attribute. Another example is one person can have more than one phone number.
Derived Attribute:
When one attribute can be derived from the other attribute, then it is called a derived attribute. We
can do some calculations on normal attributes and create derived attributes.
For example, the age of a student can be a derived attribute because we can get it by the DOB of the
student.
Another example can be of working experience, which can be obtained by the date of joining of an
employee.
In the ER diagram, we represent the derived attributes by a dotted oval shape.
o Key Attribute:
Those attributes which can be identified uniquely in the relational table are called key attributes.
3. RELATIONSHIP
Relationship tells how two attributes are related. For Example: Employee works for a department.
Degree of a Relationship Set
The number of entity sets that participate in a relationship set is termed as the degree of that
relationship set. Thus,
Degree of a relationship set = Number of entity sets participating in a relationship set
Types of Relationship Sets
On the basis of degree of a relationship set, a relationship set can be classified into the following
types-
Unary relationship set
Binary relationship set
Ternary relationship set
Unary Relationship Set
Unary relationship set is a relationship set where only one entity set participates in a relationship set.
Component Symbol
Entity
Weak Entity
Attribute
Component Symbol
Key Attribute
Composite Attribute
Multivalued Attribute
Derived Attribute
Relationship
Weak Relationship
Component Symbol
Participation Constraints