Lab2_Entity Relationship Diagram

(DATABASE MANAGEMENT SYSTEMS 1)
EXERCISE
2
DEVELOPING A LOGICAL DATA MODEL
<STUDENT NAME>
<SECTION>
<DATE>
I. OBJECTIVES
At the end of this exercise, students must be able to:
a) Examine business rules
b) Analyze and model relationship based on a set of information requirements
c) Use a relationship matrix to track the existence or relationships between entities
d) Develop an ERD using Word, Visio or Access
II. BACKGROUND INFORMATION
Logical Data Model
The goal of a logical data model is to develop an entity relationship diagram that
represents the information requirements of the business. Logical data modeling is
independent of the hardware or software to be used for the implementation.
Entity-Relationship Diagram (ERD) is a detailed, logical and graphical representation
of the entities, associations and data elements for an organization or business area.
Table 2.1 Components of an ERD
Component
Entity
Purpose
An object or concept about which you
want to store information.
Relationship
A natural association that exists between
two or more entities.
Attributes
Description of entities and specific
pieces of information that must be
known.
Example
- DEPARTMENT
- EMPLOYEE
- JOB
- DEPARTMENT may contain
one or many EMPLOYEEs.
- An EMPLOYEE must be
assigned to one and only one
DEPARTMENT.
EMPLOYEE
- First name
- Last name
- Email
Relationship Types
 One-to-One (1:1)
o Each COMPUTER must contain one and only one MOTHERBOARD.
o Each MOTHERBOARD must be contained in one and only one
COMPUTER.
 One-to-Many (1:M) or Many-to-One (M:1)
o Each CUSTOMER must be visited by one and only one SALES
REPRESENTATIVE.
o Each SALES REPRESENTATIVE may be assigned to one or more
CUSTOMERS.

Many-to-Many (M:M)
o Each EMPLOYEE may be assigned to one or more JOBS.
o Each JOB may be carried out by one or more EMPLOYEES.
Cardinality is the minimum and maximum number of values in the relationship.
 Minimum values can be either optional (zero) or mandatory (at least one).
 Maximum values can be either one or many.
Figure 2.1 Cardinalities
Using a Relationship Matrix
A relationship matrix can be used to collect initial information about the relationships
between a set of entities.
Steps:
1. Determine a relationship existence.
Examine each pair of entities to determine whether a relationship exists. Ask “Does a
significant relationship exist between ENTITY A ad ENTITY B?
Figure 2.2 Determining relationship existence
Log the relationships among ACTIVITY, DEPARTMENT, and EMPLOYEE on a
relationship matrix. The check marks indicate that a relationship exists.
2. Name the relationship.
Name each direction of a relationship. Relationship names represent a role and tend
to be passive verbs, noun role names, or prepositions.
Figure 2.3 Naming the relationship
assigned to
composed of
participate in
assigned to
Log the relationship names in the relationship matrix as shown above.
3. Determine the relationships cardinality.
a. What is the minimum cardinality in each direction?
Figure 2.4 Minimum cardinality
When the minimum cardinality is optional, the value could be zero. When the
minimum cardinality is mandatory, the value must be at least one.
b. What is the maximum cardinality in each direction?
Figure 2.5 Maximum cardinality
When the maximum cardinality is one, the value can only be one. When the
maximum cardinality is many, the value can be one or more.
4. Validate the relationship.
Re-examine the ERD and validate the relationship. Read the relationship aloud to
make sure that it is readable and makes business sense.
Figure 2.6 Validating the relationship


Each EMPLOYEE must be assigned to one and only one DEPARTMENT.
Each DEPARTMENT may be composed of one or more EMPLOYEES.
III. EXPERIMENTAL PROCEDURE
Task 1
Examine the given scenario.
The University of Toronto has several departments. Each department is managed by a
chair, and at least one professor. Professors must be assigned to one, but possibly more
departments. At least one professor teaches each course, but a professor may be on
sabbatical and not teach any course. Each course may be taught more than once by
different professors. We know of the department name, the professor name, the professor
employee id, the course names, the course schedule, the term/year that the course is
taught, the departments the professor is assigned to, the department that offers the course.
Task 2
Analyze the scenario in Task 1 and fill-in the relationship matrix in Table 2.2 to track
the existence of relationships between entities.
Table 2.2 Relationship Matrix
Task 3
Draw a complete ERD based from the relationship matrix you have created in Task 2. Do
not forget to include the cardinality constraints.
Diagram:
Task 4
Draw the ERD in Oracle SQL Developer Data Modeler based from the design that you
have created in Task 3.
IV. QUESTION AND ANSWER
1. Give three reasons why many system designers believe that data modeling is the most
important part of the system development process?
______________________________________________________________________________
______________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
2. State a rule that says when to extract an attribute from one entity type and place it in a
linked entity type.
______________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
V. REFERENCES
Young, M. (2010). Oracle Data Modeling and Relational Database Design, Vol. 1 Student
Guide, Oracle.
Hoffer, J.A., Prescott, M.B., McFadden, F.R. (2007). Modern Database Management 8th
Edition, Prentice Hall.