ER Diagram
ER Diagram
Diagra
Presented by Rajni Jindal
m
Introduction
A Relationship Type represents the association between entity types. For example,
‘Enrolled in’ is a relationship type that exists between entity type Student and Course. In ER
diagram, the relationship type is represented by a diamond and connecting the entities with
lines.
Degree of a relationship/relationship set:
• Means number of entities set(relations/tables)
associated(participate) in the relationship set. Most of the
relationship sets in a data base system are binary. Occasionally
however relationship sets involve more than two entity sets.
•Logically, we can associate any number of entities set in a
•relationship called N-ary Relationship.
•Unary
Relationship
One single entity set participate in a Relationship, means
two entities of the same entity set are related to each
other. These are also called as self - referential
Relationship set.
•Binary
Relationship
When there are TWO entities set participating in a relationship, the relationship is called a
binary relationship. For example, a Student is enrolled in a Course.
•Ternary
Relationship -
When three entities participate in a Relationship
N-ary (n degree):
When each entity in each entity set can take part only once in the relationship, the cardinality
is one-to-one. Let us assume that a male can marry one female and a female can marry one
male. So the relationship will be one-to-one.
the total number of tables that can be used in this is 2.
Using Sets, it can be represented
as:
2. One-to-Many
•In one-to-many mapping as well where each entity can be related to more than one
relationship and the total number of tables that can be used in this is 2. Let us assume that
one surgeon deparment can accomodate many doctors. So the Cardinality will be 1 to M. It
means one deparment has many Doctors.
3. Many-to-One:
• When entities in one entity set can take part only once in
the relationship set and entities in other entity sets can
take part more than once in the relationship set,
cardinality is many to one.
Using Sets, it can be represented
as
4. Many-to-Many:
When entities in all entity sets can take part more than once in the relationship cardinality is
many to many. Let us assume that a student can take more than one course and one course
can be taken by many students. So the relationship will be many to many.
the total number of tables that can be used in this is 3.
Using Sets, it can be represented
as:
Participation Constraint
1. Total Participation – Each entity in the entity set must participate in the relationship. If
each student must enroll in a course, the participation of students will be total. Total
participation is shown by a double line in the ER diagram.
2. Partial Participation – The entity in the entity set may or may NOT participate in the
relationship. If some courses are not enrolled by any of the students, the participation in the
course will be partial.
The diagram depicts the ‘Enrolled in’ relationship set with Student Entity set
having total participation and Course Entity set having partial participation.
Reduction of an E-R Schema to Tables
The database can be represented using the notations, and these notations can be reduced to a
collection of tables.
In the database, every entity set or relationship set can be represented in tabular form.
• We can represent a database that conforms to an E-R database schema by a collection of
tables.
• For each entity set and for each relationship set in the database, there is a unique table to
which we assign the name of the corresponding entity set or relationship set.
• Each table has multiple columns, each of which has a unique name.
Conversion ER to Table:
The basic E-R concepts can model most database features, some aspects of a
database may be more aptly expressed by certain extensions to the basic E-R model.
● Specialization
● Generalization
● Aggregation
Features of the EER Model
● EER generates designs that are more accurate to database schemas.
● The diagrammatic style is useful in displaying the EER schema.
● The modeling concepts that are included in the ER model are also included in the
EER model.
● The data properties and constraints reflected by the EER model are very precise.
● It incorporates the ideas of specialization and generalization.
● It is used to represent a collection of objects that are a union of distinct types of
objects.
Generalization
THANK YOU!