0% found this document useful (0 votes)
14 views24 pages

ER Modelling

The document provides an overview of the Entity Relationship (ER) model, which is a high-level conceptual framework used to design and define the logical structure of databases. It explains key components such as entities, attributes, relationships, and cardinality, along with their representations in ER diagrams. Additionally, it highlights the role of ER modeling in software development, including its benefits for visualizing data structure, improving database design, and ensuring data integrity.

Uploaded by

danboyemkay
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)
14 views24 pages

ER Modelling

The document provides an overview of the Entity Relationship (ER) model, which is a high-level conceptual framework used to design and define the logical structure of databases. It explains key components such as entities, attributes, relationships, and cardinality, along with their representations in ER diagrams. Additionally, it highlights the role of ER modeling in software development, including its benefits for visualizing data structure, improving database design, and ensuring data integrity.

Uploaded by

danboyemkay
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/ 24

Entity relationship model is a high-level

conceptual model, used to define and


Entity design the logical structure of databases.
Relationship
Model It visually represents the data,
(ER Model) relationships and constraints.

ER modelling can be done using Entity


Relationship Diagrams
Entity Entity Set Attribute

Relationship
Relationship Key Attribute
Set

Terms used in Cardinality Participation Weak entity


ER Modelling
Generalization Specialization Constraint

Sub-class Super-class Inheritance


Let’s see some important
components of ER
Models with examples
Entity

Definition Examples Representation

• An entity • Employee, • Using a


represents a Customer, rectangle*
real-world Item, etc.
object or
concept that
can have data
stored about it.
Types of Entities

Strong Entity

Week Entity

Associative Entity
Strong Entity
Definition Characteristics Example

• A strong entity is an • It has a primary key • An employee with


entity that can be that uniquely identifies attributes like
uniquely identified by each entity. employee_id, name,
its own attributes, • It is independent and email, etc
without relying on any does not rely on any
other entity. It has a other entity for its
primary key that identification.
uniquely identifies it. • It is typically
represented by a single
rectangle in ER
diagrams.
Weak Entity

Definition Characteristics Example

• A weak entity is an • A weak entity cannot • A dependent who is


entity that cannot be exist without a related to an employee
uniquely identified by its corresponding strong • Here the existence of
own attributes alone. entity. dependent relies on the
Instead, it relies on a • It uses a partial key existence of employee
strong entity (also along with the key from (strong entity).
called the owner or the strong entity to be • So, a composite primary
identifying entity) to form uniquely identified key that contains
its identification • It is represented by a emp_id, dep_id can be
double rectangle in ER used to uniquely identify
diagrams. the dependent
Associative Entity

Definition Characteristics Example

• It typically involves a • An associative


• An associative entity is many-to-many enrollments entity
a special kind of entity relationship between connecting student and
that is used to represent entities. course with additional
many-to-many (M:N) • It may have its own attributes such as
relationships between attributes that are not enrollment_date
two or more entities. found in the
• Used in the cases where participating entities.
direct relationship is not • It is represented by a
feasible between rectangle with a
entities. diamond.
Attribute

Definition Examples Representation

• An attribute is • name, salary, • Using an oval


a property or age, etc. of an shape
characteristic employee
of an entity. (entity)
Types of attributes

Simple
Composite Derived
(Atomic)
Attributes Attributes
Attributes

Multi-Valued Key-
Attributes Attributes
These are attributes that cannot be divided
further

They hold a single value for an entity

Simple
Example
Attributes
• Salary
• First name
• Last name

Represented using oval


Composite attributes are made up of multiple simple
attributes that together represent a single entity
property

Each part of a composite attribute can be individually


useful
Composite
Attributes Examples

• Full Name (which could be composed of FirstName and LastName)


• Address (could include Street, City, State, Pincode).

Represented using oval connected to other ovals


Derived attributes are those whose values can
be calculated or derived from other attributes

They are not physically stored in the database


but can be computed when needed
Derived
Attributes Example

• Age (Can be derived from Date of Birth).


• Provident Fund (PF) (can be derived from salary).

Represented using dotted oval


These attributes can have multiple values for a single
entity

Each value of the multi-valued attribute represents an


independent piece of information, but they are all
related to a single entity
Multi-Valued
Attributes Examples

• PhoneNumbers (a person can have multiple phone numbers)


• Emails (an employee can have multiple email addresses)

Represented using double oval


Key attributes are those that uniquely
identify an entity

Examples

• employee_id in employee entity which


Key Attributes uniquely identifies each employee
• order_id in order entity which uniquely
identifies each order made

Represented using oval with


underlined attribute name
Relationship
Definition Examples Representation

• A relationship is • Employee works • Using a diamond


an association on a project shape
between two or • User makes a
more entities. submission
• It represents how • Student enrolls
entities interact in a course
with one another.
Cardinality
Definition Examples Representation

• Cardinality defines • A user can have • Typically connects


the number of only one account two entities with a
instances of one (1:1) relationship
entity that can or • A user can have (diamond symbol)
must be associated multiple accounts
with instance(s) of (1:N)
another entity • Many users can
participate in many
contests (M: N)
One-to-One (1:1) Cardinality

One-to-Many (1:N) Cardinality

Types of Many-to-One (N:1) Cardinality


Cardinality
Many-to-Many (M:N) Cardinality

Zero or Optional Cardinality (0..1 or 0..N)


In this type of relationship, one instance of
an entity is associated with exactly one
instance of another entity, and vice versa
One-to-One
A Person and a Passport. Each person
(1:1) has one passport, and each passport is
Cardinality assigned to exactly one person

This is usually represented by a single line


between two entities in an ER diagram.
In this type of relationship, one instance of an entity
is associated with multiple instances of another
entity, but each instance of the second entity can be
associated with only one instance of the first entity
One-to-Many
(1:N) A Department and Employee. A department can
have many employees, but each employee works in
Cardinality only one department

Represented by a single line from the one side (the


“1” side) to the many side (the “N” side) in the ER
diagram
This is essentially the reverse of the One-to-
Many (1:N) relationship. Here, many instances
of one entity are associated with exactly one
instance of another entity
Many-to-One
(N:1) Many Employees can work in one Department.
Cardinality Each employee belongs to only one department

Represented by a single line from the many side


(the “N” side) to the one side (the “1” side) in the
ER diagram
In this type of relationship, many instances of
one entity can be associated with many
instances of another entity

Many-to-
Many (M:N) Students and Courses. A student can enroll in
multiple courses, and a course can have
Cardinality multiple students enrolled

Represented by a line connecting two entities


with “m” on one side and “n” on the other
representing many instances from both
entities are related to each other
Role / Uses of ER Modelling in Software Development

Visualizing Data Improved System


Database Design
Structure Maintenance
• ER models provide a • ER diagrams serve as a • A well-designed ER
clear, visual blueprint for creating model makes it easier
representation of how tables, defining to understand the
data entities relate to primary and foreign system’s data flow and
one another, helping keys, and structuring relationships, thus
developers and the database. aiding in future
understand the data updates, debugging,
structure before actual and scaling.
implementation.
Role / Uses of ER Modelling in Software Development

Code Efficiency Communication Tool Ensuring Data Integrity

• By defining the data • ER diagrams serve as a • By defining the


relationships early on, common language relationships between
ER modeling minimizes between developers, different entities (such
the risk of inefficiencies designers, and non- as one-to-many, many-
in the database schema, technical stakeholders. to-many), ER modeling
ensuring that developers They facilitate ensures data integrity,
can write optimized discussions about how making sure that the
code that interacts with data will be used and database schema
the database in a processed in the supports efficient data
streamlined manner. system. storage and retrieval
without redundancy.

You might also like