Presentation is loading. Please wait.

Presentation is loading. Please wait.

5 Chapter 5 Normalization of Database Tables Example Database Systems: Design, Implementation, and Management, Rob and Coronel Special adaptation for INFS-3200.

Similar presentations


Presentation on theme: "5 Chapter 5 Normalization of Database Tables Example Database Systems: Design, Implementation, and Management, Rob and Coronel Special adaptation for INFS-3200."— Presentation transcript:

1 5 Chapter 5 Normalization of Database Tables Example Database Systems: Design, Implementation, and Management, Rob and Coronel Special adaptation for INFS-3200

2 5 Database Systems: Design, Implementation, & Management, Rob & Coronel 2 Database Tables and Normalization Original Data

3 5 Database Systems: Design, Implementation, & Management, Rob & Coronel 3 Data in 1NF

4 5 Database Systems: Design, Implementation, & Management, Rob & Coronel 4 Dependency Diagram (1NF) 1NF (PROJ_NUM, EMP_NUM, PROJ_NUM,EMP_NAME, JOB_CLASS, CHG_HOUR, HOURS) Partial Dependencies: (PROJ_NUM -> PROJ_NAME) (EMP_NUM -> EMP_NAME, JOB_CLASS, CHG_HOUR) Transitive Dependencies: (JOB_CLASS -> CHG_HOUR)

5 5 Database Systems: Design, Implementation, & Management, Rob & Coronel 5 2NF Conversion EMP_NUMPROJ_NUM EMP_NUM Transitive dependency PROJ_NAME EMP_NAME JOB_CLASSCHG_HOUR ASSIGN_HOURS Table name: PROJECT Table name: ASSIGN Table name: EMPLOYEE PROJECT (PROJ_NUM, PROJ_NAME) EMPLOYEE (EMP_NUM, EMP_NAME, JOB_CLASS, CHG_HOUR) ASSIGN (PROJ_NUM, EMP_NUM, ASSIGN_HOURS) Transitive Dependencies: (JOB_CLASS -> CHG_HOUR) 1NF 2NF

6 5 Database Systems: Design, Implementation, & Management, Rob & Coronel 6 3NF Conversion PROJECT (PROJ_NUM, PROJ_NAME) EMPLOYEE (EMP_NUM, EMP_NAME, JOB_CLASS) JOB (JOB_CLASS, CHG_HOUR) ASSIGN (PROJ_NUM, EMP_NUM, ASSIGN_HOURS) EMP_NUM PROJ_NUM EMP_NUM Transitive dependency PROJ_NAME EMP_NAME JOB_CLASS CHG_HOUR ASSIGN_HOURS Table name: PROJECT Table name: ASSIGN Table name: EMPLOYEE CHG_HOUR JOB_CLASS Table name: JOB

7 5 Database Systems: Design, Implementation, & Management, Rob & Coronel 7 Improving the Design 1.Evaluate PK Assignment (meet PK guidelines) 2.Evaluate Naming Conventions 3.Refine Attribute Atomicity (simple, single-valued) 4.Identify New Attributes 5.Identify New Relationships (decompose M:M) 6.Refine Primary Keys (as required for data granularity) 7.Maintain Historical Transactional Accuracy 8.Identify Use of Derived Attributes

8 5 Database Systems: Design, Implementation, & Management, Rob & Coronel 8 Improving the Design (Job Table) 1.Evaluate PK Assignment Introduce a better suited PK free of semantic content (non- intelligent PK) Add JOB_CODE as surrogate PK. To reduce data entry errors Repeat for other tables (see # 6 – Assign)* 2.Evaluate Naming Conventions –JOB_CLASS is actually a description of the job, change to JOB_DESCRIPTION. –CHG_HOURS should be JOB_CHG_HOUR

9 5 Database Systems: Design, Implementation, & Management, Rob & Coronel 9 Improving the Design (Employee Table) 3.Refine Attribute Atomicity –Decompose composite attributes into simple attributes –EMP_NAME should be EMP_LNAME EMP_FNAME EMP_INITIAL 4.Identify New Attributes –Add new attributes that describe real world entity characteristics –EMP_HIREDATE

10 5 Database Systems: Design, Implementation, & Management, Rob & Coronel 10 Improving the Design (Project Table) 5.Identify New Relationships –Add new relationships as required by business rules. A project is managed by an employee, an employee can be the manager of only one project. Add EMP_NUM as FK in PROJECT

11 5 Database Systems: Design, Implementation, & Management, Rob & Coronel 11 Improving the Design (Assign Table) 4.Identify new attributes –Add ASSIGN_DATE 6.Refine Primary Keys –Consider the “granulity” of the data being represented in order to determine the PK. –Can an employee have multiple hours worked entries for a given day in a given project? –If yes, add ASSIGN_NUM as surrogate PK. 7.Maintain Historical Transaction Accuracy –Add ASSIGN_CHG_HOUR 8.Identify Use of Derived Attributes –Add ASSIGN_CHARGE

12 5 Database Systems: Design, Implementation, & Management, Rob & Coronel 12 Final Normalized Design

13 5 Database Systems: Design, Implementation, & Management, Rob & Coronel 13 Limitations of System Assigned PK Surrogate PK ensures that each row has an unique ID, not that the row’s dependent values are unique. JOB_CODE system assigned PK We still could have duplicate values: –511 Programmer 35.75 –512 Programmer 35.75 Clearly, entries are duplicated! To ensure unique values we must have create an unique index on all candidate keys. –Unique index on JOB_DESCRIPTION This still will still not avoid data entry errors! –513 Progranmer 35.75


Download ppt "5 Chapter 5 Normalization of Database Tables Example Database Systems: Design, Implementation, and Management, Rob and Coronel Special adaptation for INFS-3200."

Similar presentations


Ads by Google