Presentation is loading. Please wait.

Presentation is loading. Please wait.

Southern Methodist University CSE 2337 1 CSE 2337 Introduction to Data Management Chapter 5 Part II.

Similar presentations


Presentation on theme: "Southern Methodist University CSE 2337 1 CSE 2337 Introduction to Data Management Chapter 5 Part II."— Presentation transcript:

1 Southern Methodist University CSE 2337 1 CSE 2337 Introduction to Data Management Chapter 5 Part II

2 Southern Methodist University CSE 2337 2 Overview Functional Dependencies Primary Keys (and others) Normal Forms Problems with un-normalized forms Normalization in the design process

3 Southern Methodist University CSE 2337 3 1NF Review Eliminate repeating groups

4 Southern Methodist University CSE 2337 4 1NF – More Un-normalized to 1NF –Primary key will usually include the original primary key concatenated with the key to the repeating group –The key to the repeating group is the column that distinguished one occurrence of the repeating group from another on a given row.

5 Southern Methodist University CSE 2337 5 Problems with 1NF Still an issue with Redundancy Problems with update anomalies –Updates –Inconsistent Data –Additions –Deletions

6 Southern Methodist University CSE 2337 6 Problems with 1NF Update –Information in multiple rows and therefore difficult to update Inconsistency –Because of redundancy, a row that isn’t updated causes inconsistent data Additions –Dummy records are required to add new and unused dependent rows Deletions –May loose information that is still needed

7 Southern Methodist University CSE 2337 7 2NF Problems with 1NF happen (mostly) because a column is dependent on only a portion of the primary key and not the complete primary key for the table Requirements for Second Normal Form –In 1NF –No non-key column is dependent on only a portion of the primary key

8 Southern Methodist University CSE 2337 8 Dependency Diagram Use arrows to indicate functional dependencies Partial Dependency – dependent on only a portion of the primary key OrderNumOrderDatePartNumDescriptionNumOrderedQuotePrice

9 Southern Methodist University CSE 2337 9 2NF Another definition –In 1NF –No partial dependencies Resolution????? –Take each subset of the columns that make up the PK –Make new table with this subset as the primary key

10 Southern Methodist University CSE 2337 10 2NF for Orders Table (OrderNum, (PartNum, (OrderNum, PartNum (OrderNum, OrderDate) (PartNum, Description) (OrderNum, PartNum, NumOrdered, QuotedPrice)

11 Southern Methodist University CSE 2337 11 Problems with 2NF Data redundancy

12 Southern Methodist University CSE 2337 12 Problems with 2NF Consider the table –Customer (customerNum, customerName, balance, creditLimit, repNum, lastName, firstName) Functional Dependencies: –CustomerNum → CustomerName, Balance,CreditLimit, RepNum, LastName, FirstName –RepNum → lastName, FirstName

13 Southern Methodist University CSE 2337 13 3NF and Determinants Determinant – Any column (or collection thereof) that determines another column Third Normal Form (3NF) –2NF –Only determinants in the table are part of they PK

14 Southern Methodist University CSE 2337 14 3NF for Customer Table To resolve redundancy –For each determinant that is not a candidate key, remove columns that are dependent on this column (but not the determinant column itself) –Put all columns (including determinant) in a new table –Make the determinant the primary key for the new table

15 Southern Methodist University CSE 2337 15 3NF For Customer Table

16 Southern Methodist University CSE 2337 16 3NF Technically, our 3NF is really Boyce- Codd Normal Form (BCNF). Codd was the father of RDBMS theory


Download ppt "Southern Methodist University CSE 2337 1 CSE 2337 Introduction to Data Management Chapter 5 Part II."

Similar presentations


Ads by Google