Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Normalization
Page 113
An Example Relation
Key
Candidate
Key
Foreign
Key
Non-key
Attribute
Non- key
Attribute
Employee Employee
Number
Name
28719
Smith Tom
Department
Number
172
Salary
18,000
Date
Started
12/03/84
53730
Jones Bill
044
20,000
01/05/83
79313
Ropley Ed
044
11,000
18/09/81
51616
Fair Carolyn
090
50,000
05/12/79
61930
Hall Albert
090
25,000
21/06/82
Terminology in a
Relation
Terminology in a Relation
Key
Course
Number
Instructor ID
Description
Name
Room
Course
1
Teaches
Rank
Instructor
1
Advises
M
Course Enrollment
Course
Number
Grade
M
M
Student
Number
Student
Student
Number
Major
Student
Name
Description
Credit
Instructor ID
Instructor Table
Instructor ID
Instructor Name
Rank
Student Table
Student ID
Student Name
Major
Enrollment Table
Course ID
Student ID
Grade
Advisor ID
Relational Database
Advantages
Disadvantages
Equivalent Relational
Terms
Page 114
Figure 5-1
Normalization
Modification Anomalies
Functional Dependence
Example:
(Student ID, Student Name, Course ID, Course Title, Grade)
Normal Forms
A relation is said to be in a
particular normal form if it satisfies
a certain specified set of
constraints
Normal Forms
1 NF (no repeating groups)
2 NF (no partial dependencies)
3 NF (no transitive dependencies)
Boyce-Codd NF
4 NF (no multi-value dependencies)
5 NF
Domain-Key NF
transitive dependencies
A
Figure 5-7
Normalize a table
Report (Doctor Name, Specialty, Date, Patient Code,
Patient Name, Procedure Name, Charge)
Analyzing functional dependency:
Assume no duplicate Doctor Name. Otherwise
introduce a doctor ID
Assume no duplicate Procedure Name. Otherwise
introduce a Procedure code
Assume charge is determined by procedure.
Assume a patient may visit a doctor more than
once during the same day.
Answer
Doctor ID
Description
Name
Rate
Specialty
Procedure
Doctor ID
M
Treatment
Visit ID
Procedure
ID
Visit ID
Date/Time
Doctors
M
Patients
Visit
Patient
Code
1
Patient
Code
Patient
Name
Boyce-Codd Normal
Form
if every determinant is a candidate key
Figure 5-8
Instructor
Textbook
1ka3
David
Intro. Web
design
1ka3
Smith
Intro. Web
design
1ka3
David
Intro. Access
1ka3
Smith
Intro. Access
Course
Instructor
Course
Textbook
1ka3
David
1ka3
1ka3
Smith
1ka3
Intro. Access
?
Page 125
Domain
Page 125
description of an
attributes allowed values
Remarks on Normalization
Limitations of
normalization
Denormalization