Entity-Relationship Diagram (ERD)
Entity-Relationship Diagram (ERD)
(ERD)
1. Introduction.
An entity-relationship diagram (ERD) is :
Relationship
A relationship is the association that describes the
interaction between entities.
Cardinality
in the context of ERD, is the number of instances of
one entity that can, or must, be associated with each
instance of another entity. In general, there may be
one-to-one, one-to-many, or many-to-many
relationships.
Employee Entity Department Entity
department
Employee 1
department number
employee number
M name
name
department number
2 Components of E-R Diagram
Entity relational diagram (ER Diagram) is
used to represent the requirement analysis at the
conceptual design stage.
the database is designed from the ERD
or ERD is converted to the database.
1. ENTITIES
Attribute
Multivalued attributes are those that are
capable of taking on more than one value.
.
Multivalued
Attributes
Derived attributes are attributes whose value can
be calculated from related attribute values.
Derived
Attributes
Composite attributes are represented by ellipses
that are connected with an ellipse. they are further
divided in a tree like structure. Every node is then
connected to its attribute
Attribute
composite
Attribute
Attribute
Key attribute represents the main characteristic of
an Entity. It is used to represent Primary key.
Ellipse with underlying lines represent Key
Attribute.
Key
Attribute
3. Binary Relationship and Cardinality
1 1
Entity Relationship Entity
One-to-many − When more than one instance of
an entity is associated with a relationship, it is
marked as '1:N'.
The following image reflects that only one
instance of entity on the left and more than one
instance of an entity on the right can be associated
with the relationship. It depicts one-to-many
relationship.
1 N
Entity Relationship Entity
Many-to-one − When more than one instance of
entity is associated with the relationship, it is
marked as 'N:1'.
The following image reflects that more than one
instance of an entity on the left and only one
instance of an entity on the right can be
associated with the relationship. It depicts many-
to-one relationship.
N 1
Entity Relationship Entity
Many-to-many − The following image reflects
that more than one instance of an entity on the
left and more than one instance of an entity on
the right can be associated with the relationship.
It depicts many-to-many relationship.
N N
Entity Relationship Entity
Customer-name Customer-street loan-number amount
Customer-id Customer-city
Customer-id Customer-city
1
customer borrower loan
An undirected line (—) from the relationship set
borrower to the entity set loan specifies that borrower
is either a many-to-many or one-to-many relationship
set from customer to loan.
Customer-id Customer-city
N
customer borrower loan
If the relationship set borrower were one-to-many,
from customer to loan, then the line from borrower to
customer would be directed, with an arrow pointing to
the customer entity set
Customer-id Customer-city
1 N
customer borrower loan
if the relationship set borrower were many-to-one
from customer to loan, then the line from borrower to
loan would have an arrow pointing to the loan entity
set
Customer-name Customer-street loan-number amount
Customer-id Customer-city
N 1
customer borrower loan
Finally, if the relationship set borrower were one-to-
one, then both lines from borrower would have arrows
Customer-id Customer-city
1 1
customer borrower loan
Customer-id
name
street
city
address
Customer-id state
customer
zip-code
branch-city
job
employee-name street branch-name assets
employee-id city
customer-schema=(customer-id,name,address,city-state-ZIP,discount)
name City-state-zip
Discount
Customer-id
customer