Professional Documents
Culture Documents
Normalization
Immanuel Trummer
itrummer@cornell.edu
www.itrummer.org
Database Design Process
• Requirement analysis
• Conceptual design
• Schema normalization
• Physical tuning
• Conceptual design
• Schema normalization
• Physical tuning
• Conceptual design
• Physical tuning
Hours → Salary
Slides by Immanuel Trummer, Cornell University
Example Dependencies
TA Name Hours Salary
le m?
Mike
t h e P
Part Time rob 500
W ha t ' s
Anna Part Time 500
Hours → Salary
Slides by Immanuel Trummer, Cornell University
Problems
Hours → Salary
Slides by Immanuel Trummer, Cornell University
Solution Analysis
• We removed redundancy by decomposing table
• Domain knowledge
• F+ = {f|F |= f}
• F is a cover for G if F+ = G+
• {Course} → {Office}
• {Course} → {Office}
2. {Course} → {Department}
7. {Course} → {Office}
• F = {A → D, AB → E, BI → E, CD → I, E → C}
• Check if A is a key:
Allows Some
• Or b is part of some minimal key
Redundancy
• This must apply to given and inferred FDs!
Full
John 401b Full Time 1,000
Time
Part
Mike 205 Part Time 500
Time
Part
Anna 310
Time
Full
Lisa 112
Time
Hours → Salary
Slides by Immanuel Trummer, Cornell University
Lossless Recomposition
TA Name Hours Salary Office
Hours → Salary
Slides by Immanuel Trummer, Cornell University
Lossy Decomposition
TA Name Hours Hours Salary Office
Full
John Full Time 1,000 401b
Time
Part
Mike Part Time 500 205
Time
Part
Anna Part Time 500 310
Time
Full
Lisa Full Time 1,000 112
Time
Hours → Salary
Slides by Immanuel Trummer, Cornell University
Lossy Recomposition
TA Name Hours Salary Office
John Full Time 1,000 401b
Mike Part Time 500 205
Anna Part Time 500 310
Lisa Full Time 1,000 112
John Full Time 1,000 112
Mike Part Time 500 310
Anna Part Time 500 205
Lisa Full Time 1,000 401b
Hours → Salary
Slides by Immanuel Trummer, Cornell University
Towards BCNF
• Each address has an address ID, a street name and number, and an
associated country.
ER Diagram EmpID
Timestamp
AName Has
Owns
AID
Has
CName Address
Customer StreetNr
Cid StreetN
Country
Slides by Immanuel Trummer, Cornell University
Translate into
Schema!
• Employee(EmpID,Name,Job,Hours,Salary,AID)
• Supervises(EmpID,Cid)
• Address(AID,StreetN,StreetNr,Country)
• CustomerHasAddress(Cid,AID)
• From Employee(EmpID,Name,Job,Hours,Salary,AID)
• Into Employee(EmpID,Name,Job,Hours,AID),
JobHoursToSalary(Job,Hours,Salary)