E-R Model
E-R Model
E-R Model
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
Student Course
E-R Diagram
course
name
Sname
course dept
Rollno Age no
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
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
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
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