You are on page 1of 16

Entity

Relationship
Diagrams
Entity Relationship Diagram (ERD)
An Entity Relationship Diagram (ERD) is a visual representation of data
using conventions that describe how these data elements are related to
each other.
• The writer, novel, and
consumer may be described
using ER diagrams this way:
• In the diagram, the elements
inside rectangles are called
entities (nouns) while the
items inside diamonds denote
the relationships between
entities (verbs).

2
Prof. Nitin Bolinjkar
ER Diagrams Usage

ER diagrams are most often used in databases design to


identify different system elements and their relationships
with each other. • An inventory software used in
a retail shop will have a
database that monitors
elements such as purchases,
item, item type, item source
and item price.
• Adjoining ER Diagram renders
this information.
• In the diagram, the
information inside the oval
shapes is the attribute of a
particular entity.
3
Prof. Nitin Bolinjkar
ER Diagram Symbols and Notations

• There are three basic


elements in an ER Diagram:
• Entity,
• Attribute,
• Relationship.
There are more elements which
are based on the main
elements.
• weak entity,
• multi-valued attribute,
• weak relationship.

4
Prof. Nitin Bolinjkar
Entity
An entity (NOUN) can be a person, place, event, or object that is relevant to a given
system. For example, a school system may include students, teachers, major courses,
subjects, fees, and other items. Entities are represented in ER diagrams by a rectangle
and named using singular nouns.

Weak Entity
• A weak entity is an entity that
depends on the existence of
another entity.
• More specifically, it can be defined
as an entity that cannot be
identified by its own attributes.
• An entity like ‘order item’ is a good
example for this. The ‘order item’
will be meaningless without an
‘order’.

5
Prof. Nitin Bolinjkar
Attribute
An attribute is a property, trait, or characteristic of an entity, relationship, or another attribute.
For example, the attribute ‘Item Name’ is an attribute of the entity ‘Inventory Item’. An entity
can have as many attributes as necessary. Meanwhile, attributes can also have their own specific
attributes.

• The entity ‘customer’ can have the


attribute, ‘address’ which itself can
have the attributes ‘number’,
‘street’, & ‘city’. These are called
composite attributes.
• Hence, a composite attribute is one
that is composed of smaller parts.
A ‘Birth Date’ attribute can be
composed of sub-attributes
‘month’, ‘day’, and ‘year’. A ‘Name’
attribute can have ‘LastName’ &
‘FirstName’ as sub attributes.
6
Prof. Nitin Bolinjkar
Attributes (continued)

Multivalued Attribute Derived Attribute


If an attribute can have more An attribute based on another
than one value it is called an attribute, that is, attribute's
multivalued attribute. value can be derived from
For example a teacher entity other attributes. ‘Age’ is a
can have multiple subject derived attribute from
values. ‘BirthDate’. Circle ‘area’ is a
derived attribute from ‘radius’.

7
Prof. Nitin Bolinjkar
Relationship

•A relationship describes how entities


interact.
•For example, the entity “carpenter” may
be related to the entity “table” by the
relationship “builds” or “makes”.
•Relationships are represented by diamond
shapes and are labelled using verbs.

Recursive Relationship
If the same entity participates more than
once in a relationship it is known as a
recursive relationship. In the example, an
employee can be a supervisor and be
supervised, so there is a recursive
relationship.

8
Prof. Nitin Bolinjkar
Cardinality and Ordinality

• These further defines relationships between entities


by placing the relationship in the context of numbers.
• In an email system, for example, one account can
have multiple contacts. The relationship in this case
follows a “one to many” model.

• There are number of notations (Chens, UML, Crow


Feet, etc) used to present cardinality in ER diagrams.

9
Prof. Nitin Bolinjkar
Types of Relationships

One-To-Many (1:M) Relationship; One


PAINTER can Paint many PAINTINGS. 1 Paints ∞Painting
Painter
That PAINTING is Painted by only one
PAINTER.

Many-To-Many (M:N) Relationship; A


PAINTER can Paint many WALLS. That
WALL can be Painted by many Painter ∞ Paints ∞ Wall
PAINTERS.

One-To-One (1:1) Relationship; A


DRIVER has one Driving License
Number. Each Driving License Number 1 Assign 1
Driver DL#
is Assigned to only one DRIVER. ed

10
Prof. Nitin Bolinjkar
Tips on How to Draw ER Diagrams

1. Identify all the relevant entities in a given system and determine the
relationships among these entities.
2. An entity should appear only once in a particular diagram.
3. Provide a precise and appropriate name for each entity, attribute, and
relationship in the diagram.
4. In naming entities, remember to use singular nouns. However,
adjectives may be used to distinguish entities belonging to the same
class (part-time employee and full time employee, for example).
5. Attribute names must be meaningful, unique, system-independent,
and easily understandable.
6. Remove vague, redundant or unnecessary relationships between
entities.
7. Never connect a relationship to another relationship.

11
Prof. Nitin Bolinjkar
ER Diagram – Writing a Cheque

Prof. Nitin Bolinjkar


ER Diagram – Supply System

Prof. Nitin Bolinjkar


ER Diagram – Library Management
System

14
Prof. Nitin Bolinjkar
ER Diagram of Exam Database System

15
Prof. Nitin Bolinjkar
The End

U T
IN P

OUT
PU
T

16
Prof. Nitin Bolinjkar

You might also like