0% found this document useful (0 votes)
10 views34 pages

ER Modeling

The document discusses Entity-Relationship (ER) modeling, which defines the conceptual view of a database through entities, relationships, and attributes. It explains various types of entities such as strong, weak, recursive, and composite entities, along with different attribute types like simple, composite, single-valued, and multi-valued attributes. Additionally, it covers the significance of relationships, cardinality, and how attributes can be associated with both entities and relationships in ER diagrams.

Uploaded by

shaisch5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views34 pages

ER Modeling

The document discusses Entity-Relationship (ER) modeling, which defines the conceptual view of a database through entities, relationships, and attributes. It explains various types of entities such as strong, weak, recursive, and composite entities, along with different attribute types like simple, composite, single-valued, and multi-valued attributes. Additionally, it covers the significance of relationships, cardinality, and how attributes can be associated with both entities and relationships in ER diagrams.

Uploaded by

shaisch5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 34

Lecture 17

ER MODELING
Instructor: SAMIA ARSHAD
ER Modeling
• Entity relationship model defines the conceptual view of
database.
• It works around real world entity and association among
them.
• It should be understandable to both the user and to the IT
technologist.
• It must be flexible enough so that it can be used and
understood in practically any environment where
information is modelled.
• At view level, ER model is considered well for designing
databases.
ER Modeling
• It is expressed in terms of entities in the
business environment, the relationships (or
associations) among those entities and the
attributes (properties) of both the entities and
their relationships
• The E-R model is usually expressed as an E-R
diagram
 Entity
An entity is an object or concept about
which you want to store information.
e.g. person, place, object, event, concept.
 Attribute
Characteristics of an entity
 Relationship
Specify the relations among entities
Example
Entity Set
• Entity Set is a collection of entities that share
common properties or characteristics. Each
entity set is given a name, since this name
represents a set of items, it is always singular.
It is placed inside the box representing the
entity set.
Entity Types
Entities based on their characteristics are
classified as follows.
• Strong Entities
• Weak Entities
• Recursive Entities
• Composite Entities
• Strong Entity An entity set that has a primary key is
termed as strong entity set.
• Weak Entity An entity set that does not have sufficient
attributes to form a primary key is termed as a weak
entity set.
• Recursive Entity A recursive entity is one in which a
relation can exist between occurrences of the same entity
set. This occurs in a unary relationship.
• Composite Entities
If a Many to Many relationship exist we must create a
bridge entity to convert it into 1 to Many. Bridge entity
composed of the primary keys of each of the entities to
be connected. The bridge entity is known as a composite
entity. A composite entity is represented by a diamond
shape with in a rectangle in an ER Diagram.
Example of Weak and Strong entity
Attributes
• An attribute is a property or characteristic of an
entity type, for example the entity EMPLOYEE may
have attributes Employee_Name and
Employee_Address.
• In ER diagrams place attributes name in an ellipse
with a line connecting it to its associated entity
• Attributes may also be associated with relationships
• An attribute is associated with exactly one entity or
relationship
Attributes Types
In Entity Relationship(ER) Model attributes can
be classified into the following types.
• Simple and Composite Attribute
• Single Valued and Multi Valued attribute
• Stored and Derived Attributes
• Complex Attribute
Simple versus composite attributes
• Some attributes can be broken down into
meaningful component parts, such as Address,
which can be broken down into Street_Address,
City..etc.
• The component attributes may appear above or
below the composite attribute on an ER diagram
• Provide flexibility to users.
• A simple (atomic) attribute is one that cannot be
broken down into smaller components
A composite attribute
Single-Valued versus Multivalued Attribute

• It frequently happens that there is an attribute


that may have more than one value for a given
instance, e.g. EMPLOYEE may have more than
one Skill.
• A multivalued attribute is one that may take
on more than one value – it is represented by
an ellipse with double lines
Stored versus Derived Attributes
• Some attribute values can be calculated or derived
from others
• e.g., if Years_Employed needs to be calculated for
EMPLOYEE, it can be calculated using
Date_Employed and Today's_Date
• A derived attribute is one whose value can be
calculated from related attribute values (plus
possibly other data not in the database)
• A derived attribute is signified by an ellipse with a
dashed line.
Entity with a multivalued attribute (Skill) and derived attribute (Years_Employed)
Identifier attribute
• Identifier attribute or Key is an attribute (or
combination of attributes) that uniquely
identifies individual instances of an entity type,
such as Student_ID
• To be a candidate identifier, each entity instance
must have a single value for the attribute, and
the attribute must be associated with each entity
• The identifier attribute is underlined, such as
Student_ID
Identifier attribute
Composite Identifier
• A Composite Identifier is when there is no single
(or atomic) that can serve as an identifier
• Flight_ID is a composite identifier that has
component attributes Flight_Number and Date –
this combination is required to uniquely identify
individual occurrences of Flight
• Flight_ID is underlined, while its components are
not
Composite key attribute
Relationships
• A relationship is an association among the
instances of one or more entity types that is of
interest to the organization
• Relationship Type is a meaningful association
between (or among) entities – implying that
the relationship allows us to answer questions
that could not be answered given only the
entity types. It is denoted by a diamond
symbol
Relationship (Completes)
Relationship instance
• Is an association between (or among) entity
instances, where each relationship includes
exactly one entity from each participating
entity type.
• For example, in the following figure each line
represents a relationship instance between
one employee and one course, indicating that
the employee has completed that course
Relationship types
• Unary relationship
• Binary relationship
• Ternary relationship
Unary relationship
• Is between the instances of a single entity
type (also called recursive relationships)
• ‘Is_Married_To’ is a one-to-one relationship
between instances of the PERSON entity type
Binary relationships
• Between the instances of two entity types,
and is the most common type of relationship
encountered in data modelling.

Instructor Works Department


in
Ternary relationships
• A ternary relationship is a simultaneous
relationship among the instances of 3 entity
types
• It is the most common relationship
encountered in data modelling
Cardinality
• Cardinality is a constraint on a relationship
specifying the number of entity instances that
a specific entity may be related to via the
relationship.
The three classifications are:
 one-to-one
 one-to-many
 and many-to-many.
Cardinality

• Cardinality notation: Notation that shows


relationships between entities.
• Crow’s foot notation: A type of cardinality
notation. It is called crow's foot notation
because of the shapes, which include circles,
bars, and symbols, that indicate various
possibilities. A single bar indicates one, a
double bar indicates one and only one, a circle
indicates zero, and a crow's foot indicates
many.
Crow's foot notation is a common method of indicating cardinality. The four
examples show how you can use various symbols to describe the relationships
between entities.
Examples
Composite Attribute

each employee has involvement in many projects


in each project, there is involvement of many employees
Attributes on relationships
• Attributes may be associated with a many-to-
many (or one-to-one) relationship, as well as
with an entity
• e.g., an organisation may want to record the
date when an employee completes each course
• In the following diagram, the relationship
‘Completes’ joins the EMPLOYEE and COURSE
entities, and Date_Completed is joined to this as
it is a property of the relationship ‘Completes’
Attribute on a relationship

You might also like