C Major components of ER diagram
C Practices
Dixith S N 1
C 1976 proposed by Peter Chen
C ER diagram is widely used in database design
◦ Represent conceptual level of a database system
◦ Describe things and their relationships in high level
Dixith S N 2
C Entity set – an abstraction of similar things,
e.g. cars, students
◦ An entity set contains many entities
C Attributes: common properties of the entities
in a entity sets
C Relationship – specify the relations among
entities from two or more entity sets
Dixith S N 3
Dixith S N 4
C A relationship may be thought as a set as well
◦ For binary relationship, it enumerates the pairs of
entities that relate to each other
◦ For example, entity set Male = {Suresh,
Ramesh, Sylesh} entity set Female = {Rita,
Rina, Karina}. The relationship set Married
between Male and Female may be
{<Suresh, Rina>, <Ramesh, Karina>}
Dixith S N 5
Participation:
1. Maximum Participation:
It determines the maximum number of times an entity participate in a relationship.
i.e. (max. no of times a record in a table participate in a relationship with a record in another table)
2. Minimum Participation:
It determines the minimum number of time an entity can participate in a relationship.
NOTE:
If the minimum participation is 1 or greater than one then it becomes total participation.
If the minimum participation in 0 then it becomes partial participation.
CARDINALITY:
The maximum participation of an entity in a relationship is known as cardinality number.
Dixith S N 6
Dixith S N 7
Dixith S N 8
C The degree of a relationship = the number of
entity sets that participate in the relationship
◦ Mostly binary relationships
◦ Sometimes more
C Mapping cardinality of a relationship
◦ 1 –1
◦ 1 – many
◦ many – 1
◦ Many-many
12
13
14
13
14
15
C Both many and 1 include 0
◦ Meaning some entity may not participate in the
relationship
16
• When we require all entities to participate in the relationship
(total participation), we use double lines to specify
Every loan has to have at
least one customer
17
C Sometimes entities in a entity set may relate
to other entities in the same set. Thus self
relationship
C Here employees mange some other
employees
C The labels “manger” and “worker” are called
roles the self relationship
18
MAPPING OF ER-DIAGRAM:
1. Every entity requires one table.
2. Number of table also depends on the type of relationship ratio.
1. If the relationship ratio is of:
One – One
One – Many
Many – One
Then a new table for storing relationship is not required.
2. i.e. The table whose cardinality is N(Many) it’s primary key is sent as
The foreign key to the table whose cardinality is 1 (one).
3. for the relationship type:
Many – Many
A new table is created to store the relationship.
The new table will have primary key of both the tables as
foreign key.
It can also have extra attributes which describes the
relationship.
Usually the name of the relationship it self is given as the table
name.
Ex: customer, product and orders. Here orders is actualy a table
created to store the details of relationship between customer and
product, since customer and product have many-many
relationship.