2 the relational model and normalization (cont.) · pdf filelogical table design so that it...
TRANSCRIPT
1
IT468 DB @ ITAM 1
§2 – The Relational Model and
Normalization (cont.)
Fen Wang
Lecture 7
IT468 DB @ ITAM 2
Agenda
• The foundation of the relational model
• Characteristics of relations
• The basic relational terminology
• Primary, candidate, and composite keys
• How foreign keys represent relationships
• The purpose and use of surrogate keys
• The meaning of functional dependencies
• Possible insertion, deletion, and update anomalies
• Apply a process for normalizing relations
2
IT468 DB @ ITAM 3
Normalization Principles
• Primarily a tool to validate and improve a logical table design so that it satisfies certain constraints that avoid unnecessary duplication of data
• The process of decomposing relations with anomalies to produce smaller, well-structured relations, in which every determinant must be a candidate key
IT468 DB @ ITAM 4
Normal Forms
3
IT468 DB @ ITAM 5
The Normalization Process: Review Practice
• Example: Company that manages building projects
– Charges its clients by billing hours spent on each contract
– Hourly billing rate is dependent on employee’s position
– Periodically, report is generated that contains information displayed in the following Table
IT468 DB @ ITAM 6
The Normalization Process: Review Practice (cont.)
4
IT468 DB @ ITAM 7
The Normalization Process: Review Practice (cont.)
IT468 DB @ ITAM 8
Steps in Normalization Process
Remove
repeating
groups
5
IT468 DB @ ITAM 9
The Normalization Process: Review Practice (cont.)
IT468 DB @ ITAM 10
The Normalization Process: Review Practice (cont.)
6
IT468 DB @ ITAM 11
The Normalization Process: Review Practice (cont.)
IT468 DB @ ITAM 12
The Normalization Process: Review Practice (cont.)
7
IT468 DB @ ITAM 13
Steps in Normalization Process
Remove
repeating
groups
When table contains only ONE
candidate key, 3NF and BCNF
are equivalent
IT468 DB @ ITAM 14
The Normalization Process: Exercise (1)
EQUIPMENT_REPAIR (ItemNumber, Type, AcquisitionCost,
RepairNumber, RepairDate, RepairAmount)
8
IT468 DB @ ITAM 15
The Normalization Process: Exercise (1) cont.
EQUIPMENT_REPAIR (ItemNumber, Type, AcquisitionCost, RepairNumber, RepairDate, RepairAmount)
ItemNumber (Type, AcquisitionCost)
RepairNumber (ItemNumber, Type, AcquisitionCost,
RepairDate, RepairAmount)
ITEM (ItemNumber, Type, AcquisitionCost)
REPAIR (RepairNumber, ItemNumber, RepairDate, RepairAmount)
Where ItemNumber in REPAIR must exist in ItemNumber in ITEM
IT468 DB @ ITAM 16
The Normalization Process: Exercise (1) cont.
9
IT468 DB @ ITAM 17
The Normalization Process: Exercise (2)
EMPLOYEE (EmployeeNumber, LastName, Department,
Email, Department, DeptPhone)
IT468 DB @ ITAM 18
The Normalization Process: Exercise (2) cont.
• Normalized EMPLOYEE and DEPARTMENT relations and data
Where Department in EMPLOYEE must exist in Department in DEPARTMENT
10
IT468 DB @ ITAM 19
The Normalization Process: Exercise (3)
MEETING (Attorney, ClientNumber, ClientName, Date, Duration)
IT468 DB @ ITAM 20
The Normalization Process: Exercise (3) cont.
• Normalized MEETING and CLIENT relations and data
Where ClientNumber in MEETING must exist in ClientNumber in CLIENT
11
IT468 DB @ ITAM 21
Steps in Normalization Process
Remove
repeating
groups
IT468 DB @ ITAM 22
Before next class
• Practice more with MS Access 2010 and MS Visio Professional
• Continue working on Project D1
• Finalize working on Assignment#2 (due 10PM on Friday)
• Read Textbook Chapter 2 – Normalization