0% found this document useful (0 votes)
16 views39 pages

Chapter 3

The Entity Relationship (ER) Model is a logical representation of data in an organization that illustrates entities and their relationships, introduced by Peter Chen in 1976. It includes elements such as entities, attributes, and relationships, and serves as a visual communication tool for designers and users. The model also distinguishes between weak and strong entities, various types of attributes, and different relationship degrees, facilitating a structured approach to database design.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views39 pages

Chapter 3

The Entity Relationship (ER) Model is a logical representation of data in an organization that illustrates entities and their relationships, introduced by Peter Chen in 1976. It includes elements such as entities, attributes, and relationships, and serves as a visual communication tool for designers and users. The model also distinguishes between weak and strong entities, various types of attributes, and different relationship degrees, facilitating a structured approach to database design.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 39

Database Management

Systems
ENTITY RELATIONSHIP MODEL
ENTITY RELATIONSHIP MODEL
▪ ER Model is a logical representation of data in an organization.
▪ It views the entire system as a collection of entities related to one another.
▪ It is used to describe the elements of a system and their relationships.
▪ It was introduced by Peter Chen in 1976.
▪ Conceptual Simplicity to represent database, its
entities and relationship.
▪ Visual Representation of data and relationships
among data for easy understanding of system by
designers, programmers and end users.
▪ Effective Communication Tool to get different views
of data from designers, programmers and end users.
▪ Integrated with Relational database Model.
ELEMENTS OF ER MODEL
▪ Entities
▪ Entity Type
▪ Entity Instance
▪ Entity Set

▪ Attributes
▪ Attribute Domain

▪ Relationships
▪ Person, place, thing or event for which data is collected and maintained.
▪ Person: TEACHER, PLAYER, DOCTOR
▪ Place: CPUNTRY, CITY
▪ Object: VEHICLE, TOY, FURNITURE
▪ Event: PURCHASE, ADMISSION, REGISTRATION
▪ Concept: ACCONT, PROGRAMMING
▪ Example:
▪ Library System may contain data about different entities like BOOK and MEMBER.
▪ In ER Model, entity is represented by a rectangle. The name of entity is written
inside the rectangle.
▪ The entity is used in three different meanings:
▪ Entity Type or entity class : Set of entities with same attributes. E.g.
▪ STUDENT entity class is set of all students.
▪ BOOK entity class is set of all books.

▪ Entity Instance or entity occurrence: Member of an entity class having its own
value for each instance. E.g.
▪ Abdullah is an entity instance of entity type STUDENT.

▪ Entity Set: Set of all entities of a particular type in the database at a given point of
time. e.g.
▪ Entity set TEACHER may consist of all teachers in the university.

▪ Same name is used for both Entity Type and ENTITY SET.
▪ The characteristics of an entity are called attributes or properties.
▪ Example: The attributes of Entity STUDENT are Name, class, email, address etc.
▪ All instances of a particular entity class have same attributes.
▪ Attributes are represented as oval.
▪ Attribute Domain: Set of possible values for an attribute.
▪ All attributes have domain, consisting of range of values or some discrete values.

▪ Example: Domain of Grade attribute is A,B,C,D,F.

▪ Domain for gender attribute can be either male or female.

▪ The association of a domain with an attribute ensures the integrity of database.

▪ Domain is defined in form of data type (Integer, char) and some other constraints like range constraint (A-D,
F).
▪ Logical connection between different entities.
▪ The entities that participate in a relationship are called participants.
▪ The relationship may be between different entities or between and entity and
itself.
▪ A relationship is established on the basis of interaction among these entities.
▪ Example: a relationship exists between a STUDENT and TEACHER because the
teacher teaches the student.
▪ Relationship is represented using Diamond symbol.
▪ A relationship is called Total if all the entity set may be participant in the
relationship.
▪ A relationship is called partial if some of the entities of that entity set may be
participant in the relationship.
▪ Example
Relationship between SUPPLIER and PART will
be total if all parts are supplied by that
SUPPLIER, Otherwise partial.
▪ ER Diagram is a graphical representation of ER model using a set of standard
symbols.
▪ Weak Entities & Strong Entities
▪ An entity that can exist only if another entity exists is known as weak entity.
▪ It is represented by double-line square.

▪ The entity on which the weak entity depends is called owner or identifying
owner.
▪ An entity that can exist without depending upon the existence of another entity is
known as strong entity.
▪ It is also called as parent, owner or dominant entity.

▪ The relationship of these entities is


represented by double-lined diamond.
▪ Associative Entity
▪ Associates the instance of one or many entity type with one another.
▪ The attributes of the associative represents the relationship between the entity
instance.
▪ Simple Attributes
▪ An attribute that cannot be subdivided into smaller components.
▪ Also called atomic attributes.
▪ Example
▪ A person can have only one gender, one Data of birth.
▪ Composite Attributes
▪ An attribute that can be divided into smaller components.
▪ Example
▪ Address is an example of composite attributes. It can be subdivided into street,
city, country.
▪ Single Valued and multi-valued Attributes
▪ An attribute that contain single value is called single valued attribute while
multivalued attribute contain two or more values.

Example
Gender is single
valued attributes.
Employ may have
more than one skills.
Multi-valued attributes
is represented by
double-line oval.
▪ Stored attributes and Derived Attributes
▪ An attribute that is stored in a database is called stored attributes.
▪ Most of the attributes are stored attributes. These are stored and accessed from
database.
▪ An attribute that is not stored in database but derived from another value is called
derived attributes.
▪ The other value can be stored in the database or obtained in some other way.
▪ Example
▪ Stored Attribute: Name, DOB
▪ Derived Attribute: Age
▪ Derived attribute is indicated by using
an ellipse with a dashed line.
▪ Identifier
▪ An attribute that identifies an entity instance among other instances in entity class.
▪ Example
▪ Each instance of STUDENT entity class is identified by his Reg. No.
▪ Employee ID for EMPLOYEE entity class.
▪ NIC # of a PERSON entity class.

▪ Identifier can be unique or non-unique. E.g. Student ID is unique for every student
but Department is non-unique identifier as it identifies all students studying in a
particular dept.
▪ Identifier can also be simple or composite identifier.
▪ Identifier
▪ Identifier can also be simple or composite identifier.
▪ A relationship may consist of many entities.
▪ The number of entities in a relationship is called degree of relationship.
▪ The relationship of degree 2 are most common and are also called binary
relationships.
▪ The types of relationships with respect to degrees are as follows:
▪ Unary Relationship.
▪ Binary Relationship
▪ Ternary Relationship
▪ Unary relationship is a type of relationship that is established between the
instances of same entity type.
▪ This is also known as recursive relationship.
▪ Binary relationship exists between the instances of two entity types.
▪ One-to-one Relationship
▪ This type of relationship is used when “ for each entity instance in first entity class,
there is only one instance in the second entity class and for each instance in
second entity class, there is only one instance in the first entity class”.
▪ One-to-Many Relationship
▪ This type of relationship is used when “ for each entity instance in first entity class,
there can be many instances in the second entity class and for each instance in
second entity class, there is only one instance in the first entity class”.
▪ Many-to-Many Relationship
▪ This type of relationship is used when “ for each entity instance in first entity class,
there can be many instances in the second entity class and for each instance in
second entity class, there can be many instances in the first entity class”.
▪ Relationship among the instances of three entity types.
▪ Relationship among the instances of three entity types.
▪ The maximum number of relationships is called cardinality.
▪ The cardinality constraints specifies the number of instances in one entity that can
be associated with each instance of the other entity.
▪ There are three symbols used to show degree.
▪ A circle means Zero (optional relationship) means that the minimum number of
relationships between each instance of the first entity and instance of the related entity is
Zero.
▪ A line means one (Mandatory Relationship) means that the minimum number of
relationships between each instance of the first entity and instance of the related entity is
one.
▪ Crow’s foot means many
▪ The second symbol represents the cardinality.
▪ A stoke indicates that maximum number of relationships is one.
▪ Crows foot indicates that the many relationships between instances of the related
entities may exist.
▪ These symbols are as follows:
▪ The minimum number of instances of one entity may be associated with each
instance of another entity is known as minimum cardinality.
▪ If it is zero, participation is optional. If it one, participation is mandatory.
▪ The maximum number of instances of one entity that may be associated with each
instance of another entity is known as maximum cardinality.
A user may have a locker a locker must belong to an employee
Minimum
cardinality is
closer to the
middle

Maximum
cardinality is
closer to the
entity
Example

• This relationship between STUDENT and BOOK depicts a


situation in a library where the students can borrow books
from library.
Example

• This relationship between EMPLOYEE and PROJECT depicts a


situation in an organization where employees work on
different projects.
Example

• This relationship between STUDENT and COURSE depicts a


situation in an institute where the students can take different
courses to study.
Example

• This relationship between PERSON and HOBBY depicts a


situation in daily life where a person may have no or one
hobby.
• Generalization is a process of • Specialization is a process of
identifying more general entity identifying more specific entity
types. E.g. PERSON contains types. E.g. STUDENT and
general attributes than PATIENT entity types contain
STUDENT and Lawyer. attributes specific to student and
patient.
▪ Few entities in a data model may share some common properties (attributes) with
themselves. Apart from having one or more distinct attributes.
▪ Based on the attributes these entities are categorized as Supertype and Subtype
entities.
▪ Subtypes and supertypes are used to represent different levels of entity class
generalization
▪ Supertype is an entity type that has got relationship (parent to child relationship) with
one or more subtypes and it contains attributes that are common to its subtypes.
▪ Subtypes are subgroups of the supertype entity and have unique attributes, but they
will be different from each subtype.
▪ Supertypes and Subtypes are parent and child entities respectively.
▪ Subtypes inherit all supertype attributes
▪ Subtypes have attributes that are different from other subtypes

You might also like