Unnormalized table:
EmployeeID | Director | DirectorRole | Skill1 | Skill2 | Skill3 |
1001 | Brian | Technical | SQL | C++ | .Net |
1002 | Victor | Institutional | People Mgmt. | Payroll Mgmt. | Knowledge Mgmt. |
First Normal Form: No Repeating Groups
Tables should have only two dimensions. Since one employee has several skills, these skills should be listed in a separate table. Fields Skill1, Skill2, and Skill3 in the above records are indications of design trouble.
Spreadsheets often use the third dimension, but tables should not. Another way to look at this problem is with a one-to-many relationship, do not put the one side and the many side in the same table. Instead, create another table in first normal form by eliminating the repeating group (Skills), as shown below:
EmployeeID | Director | DirectorRole | Skills |
1001 | Brian | Technical | SQL |
1001 | Brian | Technical | C++ |
1001 | Brian | Technical | .Net |
1002 | Victor | Institutional | People Mgmt. |
1002 | Victor | Institutional | Payroll Mgmt. |
1002 | Victor | Institutional | Knowledge Mgmt. |
Second Normal Form: Eliminate Redundant Data
Note the multiple Skills values for each Employee value in the above table. Skill is not functionally dependent on EmployeeID (primary key), so this relationship is not in second normal form.
The following two tables demonstrate second normal form:
Employees
EmployeeID | Director | DirectorRole |
1001 | Brian | Technical |
1002 | Victor | Institutional |
EmployeeSkills
EmployeeID | Skills |
1001 | SQL |
1001 | C++ |
1001 | .Net |
1002 | People Mgmt. |
1002 | Payroll Mgmt. |
1002 | Knowledge Mgmt. |
Third Normal Form: Eliminate Data Not Dependent On KeyIn the last example; DirectorRole is functionally dependent on the Director attribute. The solution is to move that attribute from the Employees table to the Directors table, as shown below:
Employees
EmployeeID | Director |
1001 | Brian |
1002 | Victor |
Directors
Director | DirectorRole |
Brian | Technical |
Victor | Institutional |
0 comments:
Post a Comment