Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 17

ER MODEL

I. Entity relationship model is also known as ER model and it is a high level model.
II. This method is used to define the data elements and relationship for a specified
system.
III. It develops a conceptual design for the database.
IV. In ER modeling, the database structure is portrayed as a diagram called an entity-
relationship diagram.
V. It is a non-technical method, which is free from ambiguities .
VI. It provides a standard and a logical way of visualizing the data.
ELEMENTS OF ER MODEL
ENTITY
• An entity is an object or component of data. An entity is
represented as rectangle in an ER diagram
• In an ER-diagram, an entity is represented as rectangles.
• For example: In the following ER diagram we have two
entities Student and College and these two entities have
many to one relationship as many students study in a single
college.

STUDENT STUDY COLLEGE


ENTITY TYPES
• Entity types can be classified as being strong or weak entity.
• An entity type that is not existence-dependent on some other entity type is
called strong entity type.
• The strong entity type has a characteristic that each entity occurrence is
uniquely identifiable using the primary key attribute(s) of that entity type.
• An entity type that is existence-dependent on some other entity type is
called weak entity type.
• The week entity type has a characteristic that each entity occurrence
cannot be uniquely identifiable using only the attributes associated with
that entity type.
WEAK ENTITY
• An entity that cannot be uniquely identified by its own attributes and
relies on the relationship with other entity is called weak entity. The
weak entity is represented by a double rectangle. For example – a
bank account cannot be uniquely identified without knowing the bank
to which the account belongs, so bank account is a weak entity.

BANK ACCOUNT BANK


ATTRIBUTES
• Entity types have Attributes (or properties) which associate each
entity with a value from a domain of values for that attribute.

SIMPLE ATTRIBUTE

MULTI VALUED

COMPOSITE ATTRIBUTE

DERIVED

SINGLE VALUED
KEY ATTRIBUTE
KEY ATTRIBUTE
• A key attribute can uniquely identify an entity from an entity set. For
example, student roll number can uniquely identify a student from a
set of students. Key attribute is represented by oval same as other
attributes
ROLL NO NAME

AGE

STUDENT
SINGLE VS COMPOSITE
ATTRIBUTE
• A simple attribute cannot be subdivided. – examples - Age, Gender,
and Marital status.
• A composite attribute can be further subdivided to yield additional
attributes. – examples – address, street, city, state, zip, house number.

PIN

STATE
STUDENT ADDRESS

COUNTRY
DERIVED ATTRIBUTE
• Derived attribute is not physically stored within the database instead,
it is derived by using an algorithm.

• Example 2: Late Charge of 2% can be computed by using Invoice Amt


Late Charge =Invoice Amt * 0.02.

• Example 3: HRA and DA are derived attributes as they depend upon


basic pay of an employee for calculation.
SINGLE VS MULTI VALUED
ATTRIBUTE
• Single valued attributes can have only a single (atomic) value.
• Examples: A person can have only one social security number.
• A manufactured part can have only one serial number.
• A single-valued attribute is not necessarily a simple attribute
• Multi-valued attributes can have many values.
• Examples: A person may have several college degrees.
• A person may have more than one mobile numbers.
RELATIONSHIPS
• A relationship represents some association between two or more
entities. It defines the manner in which the entities interact.
• The entities that are enrolled in a relationship are known as
Participant.
• The relationships are generally given names. The may include one or
more entities. The degree of relationship is defined by the number of
participants in the relationship .
• The relationship between two entities is called binary relationship.
• The relationship between three entities is called ternary relationship.
ONE TO ONE RELATIONSHIP
• When a single instance of an entity is associated with a single instance
of another entity then it is called one to one relationship. For
example, a person has only one passport and a passport is given to
one person.

BOY HAS PASSPORT


ONE TO MANY
• When a single instance of an entity is associated with more than one
instances of another entity then it is called one to many relationship.
For example – a customer can place many orders but a order cannot
be placed by many customers.

PLACED
CUSTOMER ORDER
MANY TO ONE RELATIONSHIP
• When more than one instances of an entity is associated with a single
instance of another entity then it is called many to one relationship.
For example – many students can study in a single college but a
student cannot study in many colleges at the same time.

STUD
STUDENT Y COLLEGE
MANY TO MANY RELATIONSHIP
• When more than one instances of an entity is associated with more
than one instances of another entity then it is called many to many
relationship. For example, a can be assigned to many projects and a
project can be assigned to many students.

STUDENT ASSIGNED PROJECT

You might also like