Chap 06
Chap 06
Chapter Objectives
The purpose of this chapter is to describe in depth the major steps in logical database
design, with more emphasis on the relational model. Logical database design is the process of
transforming the conceptual data model (described in Chapter 3 and 4) into a logical data model.
First, we provide a concise description of the relational data model, including the properties of
relations. Next, we describe and illustrate the various types of integrity constraints associated
with the relational model. This section introduces SQL table definitions, and the concept of
well-structured relations. We then provide a detailed description of the process of transforming
EER diagrams into relations. Next, we define normalization and describe the steps in
normalizing relations. The chapter concludes with a discussion of merging relations, and
techniques for dealing with typical issues that arise during this process.
Specific student learning objectives are included in the beginning of the chapter. From
an instructor's point of view, the objectives of this chapter are to:
1. Show students the position of logical database design within the overall database
development process. This is a key chapter in the textbook, since students will begin to
see how their databases will be implemented.
2. Provide students with a solid understanding of the relational data model, including the
properties of relations, integrity constraints, and well-structured relations.
3. Discuss the principles and detailed steps involved in mapping EER diagrams to relations.
Computer-assisted techniques are often used to speed up this process, but students should
still understand the principles involved.
4. Provide students with a firm grasp on the principles of functional dependencies,
determinants, and related concepts of normalization.
5. Emphasize why normalization is important to stable database design with the relational,
and then present a concise description of the various normal forms and the normalization
process.
6. Discuss some of the anomalies that arise when merging relations, and how to apply the
principles we have learned to address these anomalies.
Classroom Ideas
1. Motivate the need for logical database design. We sometimes start by showing the
students the conceptual data model (E-R diagrams) for Pine Valley Furniture Company
(Figure 3-21). Emphasize that this E-R diagram must be transformed through logical
database design before it can be implemented.
2. Preview the position of logical database design in the overall database development
process (see Figure 2-5). You might want to discuss who in the organization is usually
responsible for this step, and what CASE tools might be appropriate.
3. Discuss the relational data model, using Figures 6-1 through 6-4 as examples.
4. Introduce the important integrity constraints in the relational model using Figures 6-4 and
6-5 and Table 6-1. Emphasize that these constraints will be enforced by the DBMS, but
must first be specified by the designer.
5. Introduce SQL table definitions (Figure 6-6). Show how these definitions specify the
referential integrity constraints that are diagrammed in Figure 6-5.
6. Illustrate how anomalies can occur when relations are not well-structured, using Figures
6-2b and 6-7. Emphasize the fact that much real-world data (including relational data) is
not well-structured.
7. Discuss the process of transforming EER diagrams to relations (Figures 6-8 through 6-
22). We suggest you reinforce these concepts by asking your students (in teams of two)
to perform exercise 6a in class immediately following the discussion.
8. Preview the steps in normalization using Figure 6-23. You will want to use this figure
again to summarize normalization at the end of your discussion.
9. Discuss the concepts of functional dependencies, determinants, and candidate keys. Start
with your own examples on the board, then have your students give additional examples.
Summarize using Figure 6-23.
10. Discuss first through third normal forms, using Figures 6-24 through 6-26. Additional
normal forms (BCNF and 4NF) are presented in Appendix A, if time permits.
11. We strongly suggest for you to ask your students to work in small teams on one or more
Chapter-end exercises (exercises 3 and 4 work well for this purpose).
1. f well-structured relation
e anomaly
a functional dependency
j determinant
g composite key
d 1NF
h 2NF
i 3NF
c recursive foreign key
k relation
b transitive dependency
2. Transforming E-R diagrams to relations:
a.
EMPLOYEE
EMPLOYEE SKILL
Employee_ID Skill
b.
FLIGHT
c.
EMPLOYEE
Employee_ID Employee_Name
COMPLETION
COURSE
Course_ID Course_Title
d.
EMPLOYEE
Employee_ID Employee_Name
CERTIFICATE
COURSE
Course_ID Course_Title
e.
MOVIE
Movie_Name
VIDEO TAPE
Copy_No Movie_Name
f.
PRODUCT
Product_ID
SALESPERSON
TERRITORY
Territory_ID
LOCATION
Customer_ID Territory_ID
CUSTOMER
ORDER
ORDER LINE
To PRODUCT
ii) Product Area:
PRODUCT LINE
Product_Line_ID Product_Line_Name
From
PRODUCES
PRODUCT
RAW MATERIALS
SUPPLIES
VENDOR
*The attribute Quantity was added to the USAGE relation following discussions with
users.
iii) Employee Area:
EMPLOYEE
SKILL
Employee_ID Skill_ID
ASSIGNED
Employee_ID Work_Center_ID
WORK CENTER
Work_Center_ID Location
PRODUCES
Product_ID Work_Center_ID
To PRODUCT
3. Transforming EER diagrams to relations:
a.
VEHICLE
CAR
C_Vehicle_ID No_of_Passengers
TRUCK
Physician_ID
PATIENT
OUTPATIENT
O_Patient_ID Checkback_Date
RESIDENT PATIENT
R_Patient_ID Date_Discharged
BED
Bed_ID R_Patient_ID
c.
PART
MANUFACTURED PART
M_Part_No
PURCHASED PART
P_Part_No
SUPPLY LINE
SUPPLIER
Supplier_ID Supplier_Name
d.
PERSON
EMPLOYEE
FACULTY STAFF
ALUMNUS
A_SSN
DEGREES
STUDENT
ST_SSN Major_Department
GRADUATE UNDERGRADUATE
Student_ID Student_Name
REGISTRATION
SECTION
COURSE
Course_ID Course_Name
QUALIFICATION
ASSIGNMENT
FACULTY
Faculty_ID Faculty_Name
CUSTOMER
CARD ACCOUNT
DEBIT CARD
CHARGES
MERCHANT
Merchandise_ID Merchandise_Address
7. Transforming Table 6-2 to relations:
a. PART SUPPLIER
b.
Part_No Description
Vendor_Name Address
Part_No, Vendor_Name Unit_Cost
c. Insert anomaly: we cannot insert a new vendor unless we also include a part
number.
Delete anomaly: if we delete part information, we also loose information about a
vendor who supplies that part.
Modification anomaly: if a vendor address changes, we have to modify all
records (or rows) for that vendor.
d.
e. 1NF
f.
PART SUPPLIER
Part_No Description
Vendor_Name Address
8. Transforming Table 6-3 to relations:
a.
b. 1NF
c.
STUDENT
REGISTRATION
COURSE
INSTRUCTOR
Instructor_Name Instructor_Location
d.
STUDENT
REGISTRATION
COURSE
INSTRUCTOR
Instructor_Name Instructor_Location
1. For this exercise, we suggest you interview at least two organizations: a manufacturing
company and a service sector organization (you may choose to combine this exercise with
Field Exercise 2 in Chapter 4). First, determine what methodology (if any) each uses for
conceptual design: E-R diagrams, object diagrams, etc. Then determine how these models are
transformed to logical data models (relational schema, object-oriented designs, etc.). To what
extent are these activities automated through the use of CASE tools? If the target data model
is relational, determine the role of normalization: who is responsible for normalization, to
what level is it performed, and how are users involved (if at all) in these activities?
2. We suggest you first perform this exercise as an in-class exercise with student participation in
the process. Bring a copy of your own document to class, and ask the students to volunteer a
document as well. This provides students with valuable “hands-on” experience in the bottom-
up design process.
3. For this exercise you may choose to assign a sample relational schema (such as Figure 6-13b
or 6-19b) as a basis for comparing the CASE tools.
4. This exercise is really a continuation of exercise 2 above, now possibly applied to a more
complex document. Use a report (or other document) that has detail lines and requires the use
of normalization skills.
Project Case
Project Questions
1. Mountain View Community Hospital will continue to use relational technology for
several reasons:
a. The present IS staff is trained and experienced in using this technology.
b. The present relational systems are stable and support existing operations quite
well.
c. Conversion to newer technology would be costly and would entail a number of
risks.
2. Yes, Mountain View Community Hospital should use normalization in designing its
relational database. Normalization helps avoid anomalies that impair data quality.
3. Entity integrity and referential integrity are important:
a. Entity integrity helps assure that two real-world entities (such as patient or tests)
are not confused.
b. Referential integrity helps assure that one real-world entity (such as a test result)
is not lost or disassociated from its owner entity (such as patient).
4. All users of data in the organization should be consulted during the normalization process
to ensure that the meaning and usage of data have been understood correctly.
Project Exercises
ASSIGNED
EMPLOYEE
Employee_No Employee_Name
BED
Bed_No Ward_No Room_No Patient_No
PATIENT
PERFORMS
PHYSICIAN TREATMENT
Physician_ID Physician_Name Treatment_No Treatment_Name
CONSUMES
ITEM
PATIENT
PHYSICIAN
PH_Person_ID Pager_No Specialty
VOLUNTEER
V_Person_ID Skill
EMPLOYEE
E_Person_ID Date_Hired
NURSE
STAFF
S_Person_ID Job_Class
TECHNICIAN
T_Person_ID Skill
LAB ASSIGN
T_Person_ID Name
R_Person_ID Date_Admitted
OUTPATIENT
O_Person_ID (Other)
BED
VISIT
b. EER Diagram:
5. You can use this exercise (or a selected subset) to illustrate the problems of merging
relations described in the chapter. You can also use this exercise to anticipate the design
of a data warehouse that consolidates user views (see Chapter 14).