Presentation is loading. Please wait.

Presentation is loading. Please wait.

Rob Gleasure R.Gleasure@ucc.ie www.robgleasure.com IS6125 Database Analysis and Design Lecture 11: Normalization of Data Tables Rob Gleasure R.Gleasure@ucc.ie.

Similar presentations


Presentation on theme: "Rob Gleasure R.Gleasure@ucc.ie www.robgleasure.com IS6125 Database Analysis and Design Lecture 11: Normalization of Data Tables Rob Gleasure R.Gleasure@ucc.ie."— Presentation transcript:

1 Rob Gleasure R.Gleasure@ucc.ie www.robgleasure.com
IS6125 Database Analysis and Design Lecture 11: Normalization of Data Tables Rob Gleasure

2 IS6125 Today’s session Normalisation Functional dependencies
First normal form Second normal form Third normal form

3 Themes from the reports
Three Vs Datafication and the Internet of Things Recording things is the first step Information asymmetry It’s bad for a market when one side knows more than the other about the quality of specific instances Privacy Data has value to a consumer Different types of data Self-reported data Trace/exhaust data Profiling data

4 Normalisation Not actually as terrifying as it sounds…
Just about making a database as efficient as possible by breaking big tables with redundant data into smaller tables with less redundant data We do this by taking advantage of functional dependencies

5 Inferring Functional Dependencies (The Armstrong Axioms)
1. Reflexivity: If Y is a subset of X, then X Y 2. Augmentation: If X Y, then XZ YZ 3: Transitivity: If X Y, and Y Z, then X Z

6 Normalisation: Orders Table
Full_ Name Address Zone Order _ID Date Product_1 Cost_P1 Units_P1 Product_2 Cost_P2 Units_P2 Product_3 Cost_P3 Units_ P3 John Murphy 123 Fake St Inner-city S345 31/12/ 2014 Football $20.00 2 Gloves $53.50 1 Whistle $5.00 Mary Byrne Kildaman-fadar Rural R367 9/9/ Helmet $30.50 Anne Dunne N654 10/6/ Pants $13.75 Hat $11.00 Jim Feltz 20c Fake St D896 13/06/ $28.75 Boots $75.95 S354 1/01/ 2015 Socks $3.50 5

7 Normalisation: First Normal Form
Name Address Zone Order _ID Date Product Cost Units John Murphy 123 Fake St Inner-city S345 31/12/ 2014 Football $20.00 2 Gloves $53.50 1 Whistle $5.00 S354 Socks $3.50 5 Mary Ahern Kildaman-fadar Rural R367 9/9/ Helmet $30.50 Anne Dunne N654 10/6/ Pants $13.75 Hat $11.00 Jim Feltz 20c Fake St D896 13/06/ $28.75 Boots $75.95

8 First Normal Form (continued)
Name Last_ Address Zone Order _ID Date Product Cost Units John Murphy 123 Fake St Inner-city S345 31/12/ 2014 Football $20.00 2 Gloves $53.50 1 Whistle $5.00 S354 Socks $3.50 5 Mary Byrne Kildaman-fadar Rural R367 9/9/ Helmet $30.50 Anne Dunne N654 10/6/ Pants $13.75 Hat $11.00 Jim Feltz 20c Fake St D896 13/06/ $28.75 Boots $75.95

9 Summary of First Normal Form (1NF)
A database is in the first normal form when Attributes store only atomic values Duplicate columns are removed

10 Moving to Second Normal Form
First_ Name Last_ Address Zone Order _ID Date Product Cost Units John Murphy 123 Fake St Inner-city S345 31/12/ 2014 Football $20.00 2 Gloves $53.50 1 Whistle $5.00 S354 Socks $3.50 5 Mary Byrne Kildaman-fadar Rural R367 9/9/ Helmet $30.50 Anne Dunne N654 10/6/ Pants $13.75 Hat $11.00 Jim Feltz 20c Fake St D896 13/06/ $28.75 Boots $75.95

11 Second Normal Form Cust_ID Order _ID Date Product Cost Units Cust_ID
1 S345 31/12/ 2014 Football $20.00 2 Gloves $53.50 Whistle $5.00 S354 Socks $3.50 5 R367 9/9/ Helmet $30.50 3 N654 10/6/ Pants $13.75 Hat $11.00 4 D896 13/06/ $28.75 Boots $75.95 Cust_ID First_ Name Last_ Address Zone 1 John Murphy 123 Fake St Inner-city 2 Mary Byrne Kildaman-fadar Rural 3 Anne Dunne 4 Jim Feltz 20c Fake St

12 Second Normal Form (Continued)
Cust_ ID Order _ID Date Product Units 1 S345 31/12/ 2014 2 3 S354 4 5 R367 9/9/ N654 10/6/ 6 7 D896 13/06/ 8 Cust_ ID First_ Name Last_ Address Zone 1 John Murphy 123 Fake St Inner-city 2 Mary Byrne Kildaman-fadar Rural 3 Anne Dunne 4 Jim Feltz 20c Fake St Product_ID Product_1 Cost_P1 1 Football $20.00 2 Gloves $53.50 3 Whistle $5.00 4 Socks $3.50 5 Helmet $30.50 6 Pants $13.75 7 Hat $11.00 8 Boots $75.95

13 Second Normal Form (Continued)
Cust_ID Order _ID Product Units 1 S345 2 3 S354 4 5 R367 N654 6 7 D896 8 Cust_ ID First_ Name Last_ Address Zone 1 John Murphy 123 Fake St Inner-city 2 Mary Byrne Kildaman-fadar Rural 3 Anne Dunne 4 Jim Feltz 20c Fake St Order _ID Date S345 31/12/ 2014 S354 R367 09/09/ N654 10/6/ D896 13/06/ Product_ID Product_1 Cost_P1 1 Football $20.00 2 Gloves $53.50 3 Whistle $5.00 4 Socks $3.50 5 Helmet $30.50 6 Pants $13.75 7 Hat $11.00 8 Boots $75.95

14 Second Normal Form (Continued)
Order _ID Product Units S345 1 2 3 S354 4 5 R367 N654 6 7 D896 8 Cust_ ID First_ Name Last_ Address Zone 1 John Murphy 123 Fake St Inner-city 2 Mary Byrne Kildaman-fadar Rural 3 Anne Dunne 4 Jim Feltz 20c Fake St Order _ID Cust_ ID S345 1 R367 2 N654 3 D896 4 Order _ID Date S345 31/12/ 2014 S354 R367 09/09/ N654 10/6/ D896 13/06/ Product_ID Product_1 Cost_P1 1 Football $20.00 2 Gloves $53.50 3 Whistle $5.00 4 Socks $3.50 5 Helmet $30.50 6 Pants $13.75 7 Hat $11.00 8 Boots $75.95

15 Summary of Second Normal Form (2NF)
A database is in the second normal form when It satisfies the criteria for the first normal form Each non-candidate key is dependent on the whole candidate key (i.e. subsets of data across multiple rows are removed) Put differently, we have no partial dependencies via a concatenated key Takes advantage of reflexivity and augmentation

16 Moving to Third Normal Form
Order _ID Product Units S345 1 2 3 S354 4 5 R367 N654 6 7 D896 8 Cust_ ID First_ Name Last_ Address Zone 1 John Murphy 123 Fake St Inner-city 2 Mary Byrne Kildaman-fadar Rural 3 Anne Dunne 4 Jim Feltz 20c Fake St Order _ID Cust_ ID S345 1 R367 2 N654 3 D896 4 Order _ID Date S345 31/12/ 2014 S354 R367 09/09/ N654 10/6/ D896 13/06/ Product_ID Product_1 Cost_P1 1 Football $20.00 2 Gloves $53.50 3 Whistle $5.00 4 Socks $3.50 5 Helmet $30.50 6 Pants $13.75 7 Hat $11.00 8 Boots $75.95

17 Moving to Third Normal Form
Order _ID Product Units S345 1 2 3 S354 4 5 R367 N654 6 7 D896 8 Cust_ ID First_ Name Last_ Address 1 John Murphy 123 Fake St 2 Mary Byrne Kildaman-fadar 3 Anne Dunne 4 Jim Feltz 20c Fake St Order _ID Cust_ ID S345 1 R367 2 N654 3 D896 4 Order _ID Date S345 31/12/ 2014 S354 R367 09/09/ N654 10/6/ D896 13/06/ Address Zone 123 Fake St Inner-city 20c Fake St Kildaman-fadar Rural Product_ID Product_1 Cost_P1 1 Football $20.00 2 Gloves $53.50 3 Whistle $5.00 4 Socks $3.50 5 Helmet $30.50 6 Pants $13.75 7 Hat $11.00 8 Boots $75.95

18 Summary of Third Normal Form (3NF)
A database is in the second normal form when It satisfies the criteria for the second normal form Each non-key attribute that depends on anything other than the entire primary key is removed (insertion anomalies are impossible) Put differently, we have no transitive dependencies via non-key attributes Takes advantage of transitivity

19 Readings Some more descriptions of normal forms


Download ppt "Rob Gleasure R.Gleasure@ucc.ie www.robgleasure.com IS6125 Database Analysis and Design Lecture 11: Normalization of Data Tables Rob Gleasure R.Gleasure@ucc.ie."

Similar presentations


Ads by Google