Presentation is loading. Please wait.

Presentation is loading. Please wait.

Normalizing Your Database CPT 242. Normalization The procedure where the developer analyzes the data and establishes the table structure to create the.

Similar presentations


Presentation on theme: "Normalizing Your Database CPT 242. Normalization The procedure where the developer analyzes the data and establishes the table structure to create the."— Presentation transcript:

1 Normalizing Your Database CPT 242

2 Normalization The procedure where the developer analyzes the data and establishes the table structure to create the most efficient DB Redundant data is eliminated, files will be as small as possible, and records will be easy to identify 1st, 2nd, 3rd Normal Form are the steps to normalize the data CPT 242 - Slide 2

3 1st Normal Form Repeating attributes are removed from tables Stated another way - Eliminate repeating groups of fields CPT 242 - Slide 3

4 1st Normal Form- Problems Identified CPT 242 - Slide 4 EMPLOYEES *paynum lname fname dept deptname empdate glasspurch1 doctor1 doctor1phone glasspurch2 doctor2 doctor2phone Remove from this table and create a new table to contain. Repeating attributes are removed from tables REPEATING FIELD

5 1st Normal Form-Completed CPT 242 - Slide 5 EMPLOYEES *paynum lname fname dept deptname empdate GLASSPURCH *paynum *purchdate doctor doctorphone 1 M

6 2nd Normal Form 2NF violations can only occur in tables with composite PKs All non-key fields in the table must be dependent on the entire PK The fields must be dependent on the whole PK, not just part of a composite key If fields are found that are not, they should be placed in their own table CPT 242 - Slide 6

7 2nd Normal Form- Problems Identified CPT 242 - Slide 7 GLASSPURCH *paynum *purchdate doctor doctorphone 2NF violations can only occur in tables with composite PKs All non-key fields in the table must be dependent on the entire PK Remove from this table and create a new table to contain. NOT DEPENDENT ON ENTIRE PK

8 2nd Normal Form-Completed CPT 242 - Slide 8 GLASSPURCH *paynum *purchdate doctor (FK) EYEDOCTOR *doctor doctorphone 1 M

9 3rd Normal Form 3NF violations can only occur in tables with single field PKs All non-key columns are dependent on the PK and nothing but the PK All non-key columns must be independent of each other CPT 242 - Slide 9

10 3rd Normal Form- Problems Identified CPT 242 - Slide 10 3NF violations can only occur in tables with single field PKs All non-key fields in the table must be dependent on the PK All non-key columns must be independent of each other Remove from this table and create a new table to contain. EMPLOYEES *paynum lname fname dept deptname empdate NOT DEPENDENT ON PK DEPENDENT ON DEPT FIELD

11 3rd Normal Form-Completed CPT 242 - Slide 11 DEPARTMENT *dept deptname 1 M EMPLOYEES *paynum lname fname dept empdate

12 3NF - Entire DB CPT 242 - Slide 12 GLSSPUR *paynum *purchdate doctor(FK) EYEDR *doctor doctorph M 1 DEPT *dept deptname 1 M EMP *paynum lname fname dept empdate 1 M


Download ppt "Normalizing Your Database CPT 242. Normalization The procedure where the developer analyzes the data and establishes the table structure to create the."

Similar presentations


Ads by Google