การ Normalization

  • View
    39.873

  • Download
    28

Embed Size (px)

Transcript

  • 1. 1 5 NORMALIZATION . ()

2. 2 (Function Dependencies) 3. 3 3 1 1NF 2 2NF 3 3NF 4. E-R Diagram (Unnormalized relation)1 NF2 NF3 NF(Normalization) 4 NF 4(Normalized relation) 5. (Normalization)5 (update anomalies) 6. 6 7. Employee ()Branch ()- SG21 30000 B005 B005 SG37 20000B003B003 SG14 20000B003B007 SG09 30000B007 Employee_Branch ( ) - SG21 30000 B005 SG37 20000 B003 SG14 20000 B003 7SG09 30000 B007 8. EMPLOYEE_BRANCE- SG21 30000 B005 SG37 20000 B003 SG14 20000 B003 SG09 30000 B007 o B005 o B005 8 9. EMPLOYEE_BRANCE - SG21 30000 B005 SG37 20000 B003 SG14 20000 B003 SG09 30000 B007 Primary Key 9 10. 10 SG21 B005 B003 Employee_Brance 11. - SG21 30000 B005SG37 20000 B003SG14 20000 B003SG09 30000 B007 B005B003 B007 11 12. (Functional Dependency : FD)12 X Y Attribute Relation R(X,Y) Attribute Y X X Y X 1 XY 13. EmployeeNo NamePosition S01 Manager S02 Manager AssistantS03 ManagerS04 Manager AssistantS05 StaffS06 Staff EmployeeNoPosition13 14. A) employeeNo Position B) Position (not) employeeNo14 AEmployeeNo Position employeeNo S21 Manager BPosition EmployeeNoemployeeNo S21ManageremployeeNo S41 X Y 1:1 15. ( Functional Dependency :FD)15 1) Complete dependencies 3440100634931 3437283420343 2938742039485 16. ( Functional Dependency :FD) 16 3440100634931 27/03/2520 28/04/25533437283420343 23/06/2522 25/02/25532938742039485 21/04/2525 19/0125/52,, 17. ( Functional Dependency :FD) 17 520014001 S001A 520014001 S002B 520014002 S001C 520014002 S002A , 18. ( Functional Dependency :FD)18 2) Partial Dependency ( ) Attribute Partial Dependency , , 19. Partial 534267001F01A 534267001F02B 534267002F01D 534267002F02A 534267003F01A 534267003F02C 19 20. (Functional Dependency : FD)20 3 Transitive Dependency Attribute Primary Key Attribute Primary Key 01 BMW02 Honda03 BMW04 Honda (Primary Key) , , 21. (Normalization)21 Normalization (Normal Form) 5 3 1NF - repeating group ( ) 2NF - partial dependency ( ) 3NF - transitive dependency ( ) 22. 22 23. First Normal Form (1NF)23 Attribute record single value (Repeating Group) (Tuple) Repeating group 001 204-101Repeating Group204-204204-205 002 204-102204-204 24. Second Normal Form (2NF)25 1. First Normal Form (1NF) 2. Partial Dependency ( ) 2 (Second normal form : 2NF) 25. Partial Dependency ( ) 534267001F01A 534267001F02B 534267002F01D 534267002F02A 534267003F01A 534267003F02C Partial Dependency , , 26 26. Second Normal Form (2NF)27 1) 2) 3) 4) 27. 534267001 F01A 534267001 F02B 2 NF 2 534267002 F01D 534267002 F02A 534267003 F01A 534267003 F02C 534267001F01A F01 534267001F02B F02 534267002F01D 534267002F02A 534267003F01A28 534267003F02C 28. 2NF 0001 TR01 0001 TR05 0002 TR03 0002 TR09 0003 TR01 0003 TR05 29 29. Third Normal Form (3NF)30 1.Relation 2NF 2. Non-key Attribute Transitive Dependency : 30. Third Normal Form (3NF)31 1. 2. 3. 4. 5. 3 31. P001 A00125000 P002 F00130000 Transitive Dependency 3 NF 2 P001 25000 A001A001 P002 30000 F001F00132 32. Normalization33 1NF 2NF ( ) 3NF 33. NF1-NF3 1) 53001 AB123 ACD01 3 APC093 B 53009 AB123 BCD01 3 A34 34. NF1-NF3 2) 53001 BCAB12 3 A CD01 3 A PC093 B53009HT AB123 B CD01 3 A35 35. NF1-NF3 3) OR001 02/09/2552 C001 AB12 4 4000 CD013 2000 PC09 4 6000OR002 02/09/2552 C005 TP013 3000 CD012 200036