Database Management System (DBMS)
Unit-2
Entity Relationship - ER Modeling
2.1. Introduction to ER Model
2.2. Components of an ER Model
2.2.1 Entity
2.2.2 Attributes
2.2.3 Relationships
a) Degree
b) Connectivity
c) Cardinality
d) Dependency
e) Participation
f) Composite Entities
g) Entity List
h) E-R Diagrams (ERD’s)
2.3. ER Modeling Symbols
[Link], Asst. Professor of Computer Science,
Mannar Thirumalai Naicker College, Madurai Page 1
Database Management System (DBMS)
2.1 INTRODUCTION TO ER MODEL
The Entity-Relationship (E-R) model is a high level conceptual data model developed
by Chen in 1976 to facilitate database design. The conceptual data model is a set of concepts
that describe the structure of a database, associated retrieval and update transactions on the
database.
The basic concept of the ER model includes entity types, relationship types and
attributes. The Entity is an independent object or concept in an organization. The Attribute is a
single atomic unit of information that describes about its entity.
An Entity-Relationship (ER) model describes the structure of a database with help of a
diagram, which is known as Entity Relationship Diagram (ER Diagram). The ER model is a
design or blueprint of a database that can be implemented as a database.
2.2 COMPONENTS OF AN ER MODEL
The ER model is the base of ER Diagram. The ERDs represent three main components
Entity, Attribute and Relationship.
2.2.1 ENTITY
The entity is a fundamental item in a data model. A database normally contains
different entity types. Although an entity type has a distinct set of attributes, each entity has its
own values for each attribute.
In other words, an entity is a real-world thing or a real-world object which is
distinguishable from other objects in the real world. For example, a car is an entity and the
attributes will gives us information about the characteristics of that entity.
Car (model, price, type, fuel)
There are two types in entity, tangible and intangible. The Tangible entities are those
which exist in real world physically. Ex. Person, Car, Book etc… The Intangible entities are
those which exist only logically and have no physical existence. Ex. Bank account number,
registration number, Aadhar number etc…
[Link], Asst. Professor of Computer Science,
Mannar Thirumalai Naicker College, Madurai Page 2
Database Management System (DBMS)
2.2.2 ATTRIBUTES
The attributes will define some information about its entity. An entity may contain any
number of attributes among those one of them will be considered as a primary key attribute.
There are different types of attributes in DBMS. They are simple, composite, single valued,
multi-valued, derived and complex attributes.
An attribute that cannot be further subdivided into components is called as simple
attribute. For Ex. the roll number of a student and id number of an employee.
An attribute that can be further split into various components is called as composite
attribute. For Ex. The address can be further split into house number, street, city, pincode and
district.
The attribute which takes up only a single value for an entity is called as single-valued
attribute. For Ex. The room number of a classroom.
The attribute which takes up more than a single value for an entity is called as the
multi-valued entity. For Ex. The mobile number of a person or a student.
The attribute that can be derived from other attributes is called as derived attribute.
For Ex. The total and average marks of a student, age of a student.
The attributes which can be formed by the nesting of composite and multi-valued
attributes are called as complex attributes.
For Ex. Let us consider a person having multiple mobile numbers, emails and an address. Here,
the mobile numbers and emails are multi-valued attributes and address is a composite attribute.
E-R Diagram Conventions
o The entities are represented by a rectangular box with the name of the entity in the box.
o The attribute is shown as an ellipse and labelled with the attribute name.
o The entity name is written in uppercase and attribute is written in lower case.
o The primary keys are underlined.
o If the attribute is a single or simple the single line is used.
o If the attribute is derived a dotted line is used.
o If the attribute is multivalued then double lines are used.
[Link], Asst. Professor of Computer Science,
Mannar Thirumalai Naicker College, Madurai Page 3
Database Management System (DBMS)
2.2.3 RELATIONSHIPS
The relationship in DBMS is primarily the way in which two or more data sets are
linked. It is an association between entities. The relationships are represented by a diamond
shaped symbols with the relationship name inside the diamond. The two sides of the diamond
are connected with the entities.
a) DEGREE
The degree of a relationship indicates the number of associated entities.
The UNARY relationship exists when an association maintained within a single entry.
Consider the entity SUBJECT, you have to take another subject (should take MATHS to take
SCIENCE, take ENGLISH to take TAMIL and so on). This kind of relationship is called unary
relationship shown in below figure.
SUBJECT
requires
A BINARY relationship exists when two entities that are associated. For Ex. The
BOOK and PUBLISHER relationship shown in below figure is a fine example for binary
relationship.
PUBLISHER publishes BOOK
A TERNARY relationship exists when there are three entities that are associated. For
Ex. The entities TEACHER, SUBJECT and STUDENT are related using a ternary relationship
called “teaches”. The below figure shows about the ternary relationship.
[Link], Asst. Professor of Computer Science,
Mannar Thirumalai Naicker College, Madurai Page 4
Database Management System (DBMS)
TEACHER
SUBJECT teaches STUDENT
A QUATERNARY relationship exists when there are four entities that are associated.
For Ex. The quaternary relationship is ‘studies’ where the four entities (STUDENT,
TEACHER, MATERIAL, and SUBJECT) are associated with it. This is shown in below figure.
TEACHER
STUDENT studies MATERIAL
SUBJECT
b) CONNECTIVITY
The relationship can be classified as one-to-one, one-to-many and many-to-many. The
term connectivity is used to describe this relationship classification. The E-R diagram indicates
the relationship connectivity by placing a 1, M or N near the related entities. The connectivity
in relationships are shown in below figures.
1 1
MANAGER manages DEPARTMENT
One-to-One Relationship
[Link], Asst. Professor of Computer Science,
Mannar Thirumalai Naicker College, Madurai Page 5
Database Management System (DBMS)
1 N
DEPARTMENT has EMPLOYEE
One-to-Many Relationship
EMPLOYEE N joins N COURSE
Many-to-Many Relationships
c) CARDINALITY
The cardinality expresses the specific number of entity occurrences associated with one
occurrence of the related entity.
DEPARTMENT
1 N
has EMPLOYEE
(0,100) (1,1)
One-to-Many Relationship
N N
EMPLOYEE joins COURSE
(0,2) (0,10)
Many-to-Many Relationship
For Ex. The company policy does not allow more than 100 employees in a department.
So, the cardinality rule of DEPARTMENT-EMPLOYEE relationship is expressed as “One
department can have a maximum of 100 employees”.
d) DEPENDENCY
The entities are classified into strong and weak entity types. An entity that existence-
dependent on some other entity is called weak entity. An entity that nonexistence dependent on
some other entity is called strong entity.
[Link], Asst. Professor of Computer Science,
Mannar Thirumalai Naicker College, Madurai Page 6
Database Management System (DBMS)
In simple words, a strong entity is independent and weak entity is dependent. The weak
entity is also referred to as child, dependent or subordinate entities and strong entities are as
parent, owner or dominant. The below diagram shows the strong and weak entity.
COMPANY employs EMPLOYEE
PARENT has
e) PARTICIPATION
There are two ways an entity can participate in a relationship – totally or partially. The
participation is also known as mandatory or optional.
The participation is total (mandatory) if an entity existence requires existence of an
associated entity in a particular relationship. It specifies each entity in the entity set must
compulsorily participate in at least one relationship instance in the relationship set.
The participation is partial (optional) if the occurrence of one entity does not require the
occurrence of another corresponding entity in a relationship. It specifies each entity in the
entity set may or may not participate in the relationship instance in that relationship set.
N N
EMPLOYEE joins COURSE
(0,2) (0,10)
It is very important to understand about each and every entity whether it is mandatory
or optional one in the relationship. Failing of this will impact to creation of unnecessary
creation of entities.
The one-to-one relationship defines the relationship between the entities EMPLOYEE
and the CONSULTANT.
[Link], Asst. Professor of Computer Science,
Mannar Thirumalai Naicker College, Madurai Page 7
Database Management System (DBMS)
The one-to-many relationship defines the relationship between the EMPLOYEE and
DEPARTMENT. The EMPLOYEE works for only one DEPARTMENT whereas the
DEPARTMENT can have more than one EMPLOYEE.
The many-to-many relationship defines relationship between the AUTHOR and the
PUBLISHER. The AUTHOR can have more than one PUBLISHER likewise the PUBLISHER
will publish books of more than one AUTHOR.
name age sex
emp_no EMPLOYEE salary
emp_no CONSULTANT designation
client
One-to-One Relationship
name age sex
emp_no EMPLOYEE salary
dept_id DEPARTMENT name
One-to-Many Relationship
[Link], Asst. Professor of Computer Science,
Mannar Thirumalai Naicker College, Madurai Page 8
Database Management System (DBMS)
name age sex
address AUTHOR phone
name PUBLISHER editor
address
Many-to-Many Relationship
name age sex
emp_no EMPLOYEE salary
emp_no CONSULTANT designation
client
Representation of an employee and consultant relationship with
mandatory and optional (horizontal line and circled)
[Link], Asst. Professor of Computer Science,
Mannar Thirumalai Naicker College, Madurai Page 9
Database Management System (DBMS)
f) COMPOSITE ENTITIES
The many-to-many relationships in the ER model must be broken into one-to-one
relationships. This is done by composite entity. The composite entities are represented using a
diamond shape within a rectangle.
work_type work_title length
author_id publisher_id
AUTHOR 1 N N 1 PUBLISHER
work
author_id name publisher_id name
city country city country
The Composite Entity Work
g) ENTITY LIST
The database model uses the entities their attributes and relationships to construct
a representation of the real world system. An entity list is a list or collection of the
entities in the application and their attributes. For Ex. The entity list of the book is
shown below.
BOOK ( isbn, title, publisher, publication_year, price)
h) E-R DIAGRAMS (ERDs)
The Entity Relationship Diagram (ERD) symbols and notations are mainly contains
three basic symbols which are rectangle, oval and diamond to represent relationships between
elements, entities and attributes. The connector line is used to depict the interconnection of
entities, relationships and their attributes. They are shown below.
[Link], Asst. Professor of Computer Science,
Mannar Thirumalai Naicker College, Madurai Page 10
Database Management System (DBMS)
Example of a simple ER diagram
2.3 E-R MODELING SYMBOLS
1. Entity
2. Weak Entity
3. Attribute
4. Multi-valued Attribute
5. Relationship
6. Connector
[Link], Asst. Professor of Computer Science,
Mannar Thirumalai Naicker College, Madurai Page 11
Database Management System (DBMS)
7. Weak Relationship
8. Composite Entity
9. Mandatory One
10. Mandatory Many
11. Optimal One
12. Optimal Many
******
[Link], Asst. Professor of Computer Science,
Mannar Thirumalai Naicker College, Madurai Page 12