Tuesday, May 22, 2012

Entity Relationship Model

Based on a perception that a real world consists of a set of basic objects, called Entities, and Relationships among these objects.

Entity - Thing which has existence distinguishable from other objects (things)

Entity Properties
  1.  independent existence
  2. can be concrete or abstract
  3. described by its attributes (set of properties)
  4. determined by particular value of its attributes

Attributes - Descriptive Property  of entity and  Takes values from a permitted set - Domain or value set

Information about an entity or relationship can be expressed by a set of (attribute,value) pairs

Person entity with attributes name, age
    { (name, Hari),(age,20) }

Types of Attributes

Simple vs Composite

Is a function which maps from one entity set or relationship set into a value set or a Cartesian product of value sets.

simple attribute
    Ai : E or R -----> Vi    
    name : Person ---> string

composite attribute
    Ai : E  or R -----> Vi1 X Vi2 X……..Vin

Single vs Multivalued

Single valued - one value for an entity. Attribute name has one value Hari
Multivalued - a set of values for an entity. Attribute tel-number has more than one telephone number

Stored vs. Derived attribute

Stored – value stored in the database
Derived - value derived from other related attributes
Stored: Individual mark of a student, date-of-birth
Derived: Overall grade in a class, age

Entity Set

An entity set is a set of entities of the same type; entities that share the same properties.

Entity sets : Employee, Project, Department

Relationship and Relationship set

A relationship is an association among several entities.
A relationship set is a set of relationships of the same type

Let E1, E2, ... En be a set of entity sets.
E1, E2, ... En participate in the relationship R
is a relationship
R is a subset of E1 x E2 x ... x En
= { where ei is an element of Ei }


Entities participating in relationships play the respective roles in them.
Role is the function performed by the entity in the relationship.

Ownership is a relationship between Person and House
The entities play the role of owner and owned respectively.


rectangle: entity Set

ellipse: attribute

diamond: relationship

line: link attributes to entity sets and entity sets to relationship sets

double ellipse:multivalued attributes

dashed ellipse:derived attributes

Relationship Attribute

An attribute can also be a property of a relationship set

Degree of relationship set

Refers to the number of entity sets that participate in a relationship set.
Relationships that involve two entity sets are called binary


Express the number of entities to which another entity can be
associated via a relationship set

-one to one
-one to many
-many to one
-many to many


The participation of an entity set E in a relationship R is total if every entity in E participates in at least one relationship in R. partial otherwise

Weak Entity

Entities that are distinguished by their relationship to another entity. Weak entity has partial key or discriminator – Identify entities related to the same strong entity.

The primary key =  primary key of the strong entity set + discriminator.


expressing relationship with a relationship

Generalization - Specialization

Abstracting the common properties of two or more entities into a “higher-level” entity.

Specialization = top-down design
Generalization= bottom-up design

No comments:

Post a Comment