DAT702 Normal Forms Normalization Rules
Normal Forms Normal Forms, also called Normalization rules, are basically processes or steps taken to allow for the efficient creation of Relational databases. Following these rules lead an administrator towards a set of tables that: allow data to be organized in an efficient manner reduce disk space requirements for data storage minimize or eliminate redundant data greatly reduce the chance of data entry errors provide programmers with a stable data platform from which to create efficient applications
The Rules We will concentrate on the first three rules as they should be enough to create proper data tables for most circumstances. Rule 1:If a table contains repeating groups (fields) of data then these groups (fields) should be removed and placed into another table (child/foreign) as a single field. Rule 2:If a table contains records that have repeating data (redundant) then create a new table. Rule 3:All fields within a table must relate directly to and describe the Primary Key.
Form 0 (Flat File) Notice the repeating groups of data (Course1, Course2). Adding course data limited to number of current fields Violates all 3 Normal Form rules Table: Students Student# Name Course1 CourseDesc1 Course2 CourseDesc Fred DAT702 Database Admin CDD301 DataComm Jane OPS400 AS/400 OPS440 Unix Admin
Correcting with Rule #1 Table: Students StudentNo Name Course1 CourseDesc1 Course2 CourseDesc Fred DAT702 Database Admin DCN386 DataComm Jane OPS400 AS/400 OPS435 Unix Admin StudentNo Name CourseCode CourseDesc Fred DAT702 Database Admin Fred DCN386 DataComm Jane OPS400 AS/ Jane OPS435 Unix Admin Table: Students Converted to 1st Normal Form Better: But still violates Rules 2 & 3
Correcting with Rule #2 StudentNo(P) Name Fred Jane Table: Students Converted to 2 rd Normal Form Table: Courses Primary – Foreign Key Relationship StudentNo Name CourseCode CourseDesc Fred DAT702 Database Admin Fred DCN386 DataComm Jane OPS400 AS/ Jane OPS435 Unix Admin Rule 3 violation CourseCode(P) StudentNo(F) CourseDesc DAT Database Admin DCN DataComm OPS AS/400 OPS Unix Admin
Correcting with Rule #3 StudentNo(P) Name Fred Jane Table: Students Converted to 3 rd Normal Form Table: Stud_Courses Primary – Foreign Key Relationship StudentNo(P) Name Fred Jane CourseCode(F) StudentNo(F) DAT DCN OPS OPS Table: Students Table: Courses CourseCode(P) Description DAT702 Database Admin DCN386 DataComm OPS400 AS/400 Table: Courses CourseCode(P) StudentNo(F) CourseDesc DAT Database Admin DCN DataComm OPS AS/400 OPS Unix Admin