Learn IT

Free learning anything to everything in Information Technology.

Normalizing a Sample Table

Unnormalized table:

EmployeeIDDirectorDirectorRoleSkill1Skill2Skill3
1001BrianTechnicalSQLC++.Net
1002VictorInstitutionalPeople 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:

EmployeeIDDirectorDirectorRoleSkills
1001BrianTechnicalSQL
1001BrianTechnicalC++
1001BrianTechnical.Net
1002VictorInstitutionalPeople Mgmt.
1002VictorInstitutionalPayroll Mgmt.
1002VictorInstitutionalKnowledge 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

EmployeeIDDirectorDirectorRole
1001BrianTechnical
1002VictorInstitutional

EmployeeSkills

EmployeeIDSkills
1001SQL
1001C++
1001.Net
1002People Mgmt.
1002Payroll Mgmt.
1002Knowledge 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

EmployeeIDDirector
1001Brian
1002Victor

Directors

DirectorDirectorRole
BrianTechnical
VictorInstitutional

0 comments: