You are on page 1of 14

Entity Relationship Diagram

Questions Answered
Question 1
• A software training program is divided into
training modules, and each module is
described by module name and the
approximate practice time.
• Each module sometimes has prerequisite
modules.
Entities and Attributes
• Entities
TRAINING_PROGRAM TRAINING_MODULE

• Attributes
TRAINING_MODULE
TRAINING_PROGRAM

ModName
PracticeTme
Relationships
• A software training program is divided into training
modules
– 1 program → many modules
– 1..* (one-to-many relationship)
• Each module sometimes has prerequisite modules.
– Think of a course , there maybe 0 pre-requisite, 1 pre-
requisite or there may be many pre-requisites
– That prerequisite maybe a pre-requisite for many courses
– Many modules → many pre-requisites
– *…* (many-to-many relationship)
ERD
is prerequisite for

0..*

TRAINING_MODULE
TRAINING_PROGRAM 1..1 1..*
0..*
is composed of ModName
PracticeTme
Question 2
• Each semester, each student must be assigned an
adviser who counsels students about degree
requirements and helps students register for classes.
• Students must register for classes with the help of an
adviser, but if their assigned adviser is not available,
they may register with any adviser.
• We must keep track of students, their assigned
adviser, and with whom the student registered for
the current term.
Entities and Attributes
• Entities
STUDENT ADVISOR

• Attributes
ADVISOR
STUDENT

StudentID{PK} AdvisorNo{PK}
StudentName AdvisorName
Relationships
• There are two relationships
• Each student must be assigned an adviser
– An advisor is assigned to zero students or to many students
– A student is assigned to exactly one advisor
– 0..*
• Students must register for classes with the help of an
adviser
– An advisor registers zero students or many students
– A student is registered by exactly one advisor.
– 0..*
ERD

STUDENT ADVISOR
0..* 1..1
StudentID{PK} is assigned to AdvisorNo{PK}
StudentName AdvisorName

0..* 1..1

registers
Question 3
Question 3
• How many PROJECTs can an employee work
on?

– An employee can work on one-to-many projects.


Question 3
• Multiplicity defines how many objects
participate in a relationship and it is the
number of instances of one class related
to one instance of the other entity.
What is the multiplicity of the “includes”
relationship?

• The Includes relationship is a 1..N


relationship so a project has a least one
task or it can have many task. But a
given task is for one and only 1 project.
Question 3
• How can we break up the many to many
relationship into two one-to-many
relationships?

• We can introduce a new relation (table),


Employee Project, which keeps track of the
Employee Id and the Project Id
Question 3

You might also like