You are on page 1of 20

E - R model

Prepared by Harish Patnaik

School of Computer Engineering, KIIT Deemed to be University


Content

1. Introduction
2. Entity, Relationship
3. Key
4. Entity set
5. Mapping Cardinalities
6. Extended E-R model
Introduction
• A data model is a collection of concepts that
can be used to describe the structure of a
database.
• Data medeling is the process of identifying the
entities in the system and their relationship
and representing everything in a proper
format.
E-R model
Entity - It is the basic unit used in modeling classes
of concrete or abstract objects.
Entity set - It is the group of simlar objects of
concern to an organisation for which it maintains
data.
Attribute - the properties that characterize an entity
set.
• Simple and composite attribute
• Single valued and multi-valued attribute
• Derived attribute
• Descriptive attribute
Relationship
• Interaction among entities are represneted as
Relationship in the model.
• Types of binary relationship
• 1 to 1 relationship - For each entity in
either set there is at most one entity in the
associated set.
Department HOD
Relationship
• 1 to many relationship - For an occurrence of th
entity from set E1, there could be one or more
entities from set E2 associated with it. But each entity
in E2 is associated with at most one entity in E1.

Manager Employee

• Many to many relationship - No restriction as to the


no. of entities in one set associated with an entity in
the other set.
Employee Project
Participation
• Participation of an entity set E in a relationship set R
is said to be Total if every entity in E participates in at
least one relationship in R.

• If only some entities in E participate in relationship R


then the partcipation of E is said to be Partial .

Student Course
E-R Diagram

course
name
Sname
course dept
Rollno Age no

Student registers Course

Date of
regn
Keys
• A key identifies a set of attributes which can distinguish
entities from each other.
• A super key is a set of one or more attributes that, taken
together, allows us to identify uniquely an entity in the
entity set.
If x is a super key for any two entities E1 & E2 of an
entity set then E1.x ≠ E2.x
• If K is a super key then any superset of K is also a super key.
• Minimal super key is called Candidate key.
• An entity set may have more than one candidate key. Any
one will be Primary key and others are called Alternate key.
Entity Set

• Entity set that has a primary key is called as


Strong entity set.
• Entity set that may not have sufficient
attributes to form a primary key is termed
as Weak Entity set
Payment
payment_no Payment_date Payment_amount
Entity Set
• A Weak Entity set is always associated with
another entity set called Identifying or
Owner Entity set.
• Primary key is {loanno, payment_no}
payment_
amount

payment paymen
Loanno Amount _no t_date

Loan
paymen Payment
Loan
t
Question
There are differnt institutions in the state with inst_id
alongwith name and domain. Each institution is conducting
one annual fest (unique festid,festname,budget,theme) in
each session.Many people are attending the fest. Each
person has unique pid alongwith pname,age and contact(s).
The people can be categorized as either Employee(with
deptno) or Student (with rollono) or membr (with
member_id).Employees are managing the students. Each
annual fest contains many events (with unique evid,evname
and category). The students are participating in one or more
events. Similarly, many students are participating in an event.
Each event contains diffent rewards. Each reward has a
rewardname and prize. Each reward can be identified by
rewardname once the event is known.
Mapping Cardinalities

• It indicates the no. of entities to which another entity can


be associated via relationship set. For a binary relationship
set R between entity set A and B, the mapping cardinalty
must be one of the following -
ü one to one
ü one to many
ü many to one
ü many to many
Extended E-R Model
a> Specialziation - an entity set may include subgroupings of
entities that are distinct in some way from other entities in
the set.
• Process of deisignating subgroupings in an entity set
Pname
Age
Address

Person

IS
Empid A
Custid

Emplyee Customer
Extended E-R Model
b> Generalization - Multiple entitysets are synthesized into a
higher level entity set on the basis of common features.
Example - Manager and Engineer
• This is a containment relationship that exists between a
higher level entity set and one or more lower level entity
sets.
• Inversion of Specialization
• Attribute inheritance -
• Participation inheritance -
Constraints on Generalization
To prepare a model more accurately some constraints may be
placed -
i>Constraint for determining which entities can be member of
a given lower level entity set.
• Condition defined - ex - personid attribute
• User defined - ex- completion of training
ii>Entities may belong to more than one lower level entity set
• Disjoint
• Overlapping - default
Constraints on Generalization

iii>Completeness - whether an entity in the higher level set


must belong to at least one of the lower level entity set

• Total generalization or specialization


• Partial generalization or specialization - default
Ex- some persons may be neither employee nor
customer
Extended E-R Model
c> Aggregation - Representation of relationship among
relationship (works_on and manages)
• Redundant of information in works_on and manages

works
Employee Branch
-on

Project

manages

Manager
Extended E-R Model
Aggregation - is an abstraction through which relationships
(works-on) are treated as a higher level entity set

Project

works
Employee Branch
-on

manages

Manager
Thank you

You might also like