Entity-Relationship Model: UCS310:DBMS 1
Entity-Relationship Model: UCS310:DBMS 1
Model
UCS310:DBMS 1
How to design the
database?
There are two approaches
E-R Modeling: Identifying entity and
relations
Normalization: Refinement of database
designing
UCS310:DBMS 2
Entity-Relationship Model
UCS310:DBMS 3
E-R Model
The Entity-Relationship (ER) model was
originally proposed by Peter in 1976
The ER model is a conceptual data model
that views the real world as entities and
relationships.
A basic component of the model is the
Entity-Relationship diagram, which is used
to visually represent data objects.
UCS310:DBMS 4
Basic Constructs of E-
R Modeling
Entities
Entities are the principal data object about which
information is to be collected. Entities are usually
recognizable concepts, either concrete or
abstract, such as person, places, things, or
events, which have relevance to the database.
Some specific examples of entities are
EMPLOYEES, PROJECTS, and INVOICES. An
entity is analogous to a table in the relational
model.
UCS310:DBMS 5
Relationships
UCS310:DBMS 6
Attributes
Attributes describe the properties of the entity of which they are
associated. A particular instance of an attribute is a value. For
example, "Ram" is one value of the attribute Name. The domain
of an attribute is the collection of all possible values an
attribute can have.
We can classify attributes as following:
¨ Simple
¨ Composite
¨ Single-values
¨ Multi-values
¨ Derived
UCS310:DBMS 7
Attributes
1. Simple Attributes : A simple attribute is an attribute
composed of a single component with an independent
existence. Simple attributes cannot be further
subdivided. Examples: Age, Salary etc.
UCS310:DBMS 8
Attributes
3. Single-valued Attribute: A single-valued attribute is
one that holds a single value for a single entity. The
majority of attributes are single-valued for a particular
entity. For example, the classroom entity has a single
value for the room_number attribute and therefore, the
room_number attribute is referred to be as being single-
valued.
4. Multi-valued Attribute: A multi-valued attribute is
one that holds multiple values for a single entity. For
example, a student entity can have multiple values for
the Hobby attribute – reading, music, movies and so on.
This attribute may have set of numbers with upper and
lower limits. For example, a student can have minimum
1 hobby and maximum 5 hobbies.
UCS310:DBMS 9
Attribute
Derived Attribute: A derived attribute is one that represents a
value that is derivable from the value of a related attribute or
set of attributes, not necessary in the same entity. Some
attributes may be related to a particular entity. For example,
the Age attribute can be derived from date-of-birth attribute
and therefore they are related. We refer the age attribute as a
derived attribute.
UCS310:DBMS 10
Degree of a Relationship
UCS310:DBMS 11
Connectivity and Cardinality
UCS310:DBMS 12
Direction
UCS310:DBMS 13
UCS310:DBMS 14
UCS310:DBMS 15
Simplified Approach To DBMS: Parteek Bhatia
UCS310:DBMS 16
E-R Notation
¨ Entities are represented by labeled rectangles. The label is the name of the
entity. Entity names should be singular nouns.
UCS310:DBMS 17
Simplified Approach To DBMS: Parteek Bhatia
UCS310:DBMS 18
Simplified Approach To DBMS: Parteek Bhatia
UCS310:DBMS 19
UCS310:DBMS 20
UCS310:DBMS 21
UCS310:DBMS 22
Consider the following
database:
S (S#, SSNAME, STATUS, CITY)
UCS310:DBMS 23
Simplified Approach To DBMS: Parteek Bhatia
UCS310:DBMS 24
Strong and Weak Entity
Sets
The entity set which does not has sufficient attributes to form a primary
key is called as weak entity set. An entity set that has a primary key is
called as Strong entity set. Consider an entity set Payment which has
three attributes: payment_number, payment_date and payment_amount.
Although each payment entity is distinct but payment for different loans
may share the same payment number. Thus, this entity set does not have
a primary key and it is a weak entity set. Each weak set must be a part of
one-to-many relationship set.
A member of a strong entity set is called dominant entity and member
of weak entity set is called as subordinate entity. A weak entity set
does not have a primary key but we need a means of distinguishing
among all those entries in the entity set that depend on one particular
strong entity set. The discriminator of a weak entity set is a set of
attributes that allows this distinction to be made. For example,
payment_number is acts as discriminator for payment entity set. It is
also called as the Partial key of the entity set.
UCS310:DBMS 25
Simplified Approach To DBMS: Parteek Bhatia
UCS310:DBMS 26
Generalization
UCS310:DBMS 27
UCS310:DBMS 28
Specialization
Specialization is the process of taking subsets of a higher-level
entity set to form lower level entity sets. It is a process of
defining a set of subclasses of an entity type, which is called as
superclas of the specialization. The process of defining subclass
is based on the basis of some distinguish characteristics of
the entities in the super class.
For example, specialization of the Employee entity type
may yield the set of subclasses namely Salaried_Employee
and Hourly_Employee on the method of pay
UCS310:DBMS 29
Simplified Approach To DBMS: Parteek Bhatia
UCS310:DBMS 30
Difference between Specialization and Generalization
UCS310:DBMS 31
END
UCS310:DBMS 32