Presentation is loading. Please wait.

Presentation is loading. Please wait.

IFS180: Intro. to Data Management Chapter 2 Ensuring your database structure is sound.

Similar presentations


Presentation on theme: "IFS180: Intro. to Data Management Chapter 2 Ensuring your database structure is sound."— Presentation transcript:

1 IFS180: Intro. to Data Management Chapter 2 Ensuring your database structure is sound

2 Intro. to Data Management Brief Review from last week Function of PK Function of FK One – to – One Relationship One – to – Many Relationship Many – to – Many Relationship

3 IFS180: Intro. to Data Management Functional Dependencies and Normalization Functional Dependency: A functional dependency occurs when one attribute in a relation uniquely determines another attribute. This can be written A -> B which would be the same as stating "B is functionally dependent upon A." BudsCost = Boxes Buds * $2.25 BudsCost functionally dependant on Number of Boxes Number of Boxes  BudsCost Determinant Determines

4 IFS180: Intro. to Data Management Functional Dependencies and Normalization Examples: PretzelCost = Bags of Pretzels * $1.39 TotalCost = Quantity * Price

5 IFS180: Intro. to Data Management Functional Dependencies and Normalization Object ColorWeight Red1 White2 Blue3 Object Color  Weight Object ColorWeightShape Red1Square White2Rectangle Blue3Cylinder Object Color  (Weight, Shape) Color  Zone Color  (Zone, Price)

6 IFS180: Intro. to Data Management Characteristics of a Relation Rows contain data about an entity Columns contain data about attributes of entity Columns in table hold a single value All entries in columns are of the same kind Each column has a unique name Column order is not important Row order is not important No row duplicates

7 IFS180: Intro. to Data Management Data Normalization @ 10,000 Feet First Normalized Form (1NF) No Composite attributes in a relation Second Normalized Form (2NF) 1NF and every column is dependent on PK Third Normalized Form (3NF) 2NF and all columns (non Keyed) are not related (mutually independent)

8 IFS180: Intro. to Data Management 1NF – No composite Attributes Identify all candidate keys Part NumberDescriptionSales OrderSO CustomerShip LocationAttention WPG-6739Chocolate, Milk746538Jim's CandiesDallasKaren COA-7634Cocoa Powder532439House of ChocolatePhiladelphiaPete PJH-6380Chocolate, White9836823All Types of ChocolateNew YorkSteve JDO-8376Chocolate, Dark472350Dark Chocolate SpecialtiesBostonAnn HYT-6594Cocoa Powder948463All Types of ChocolateNew YorkSteve PKD-4872Chocolate652820The Candy ShopBaltimoreTim Candidate Key

9 IFS180: Intro. to Data Management 2NF All Columns dependent on PK Identify all functional dependencies A  B Part NumberDescriptionSales OrderSO CustomerShip LocationAttention WPG-6739Chocolate, Milk746538Jim's CandiesDallasKaren COA-7634Cocoa Powder532439House of ChocolatePhiladelphiaPete PJH-6380Chocolate, White9836823All Types of ChocolateNew YorkSteve JDO-8376Chocolate, Dark472350Dark Chocolate SpecialtiesBostonAnn HYT-6594Cocoa Powder948463All Types of ChocolateNew YorkSteve PKD-4872Chocolate652820The Candy ShopBaltimoreTim Determinant Dependency

10 IFS180: Intro. to Data Management 3NF All columns are Mutual Exclusive Review Determinates (from 2NF) and if any are not candidate keys relation is not normalized. Part NumberDescriptionSales OrderSO CustomerShip LocationAttention WPG-6739Chocolate, Milk746538Jim's CandiesDallasKaren COA-7634Cocoa Powder532439House of ChocolatePhiladelphiaPete PJH-6380Chocolate, White9836823All Types of ChocolateNew YorkSteve JDO-8376Chocolate, Dark472350Dark Chocolate SpecialtiesBostonAnn HYT-6594Cocoa Powder948463All Types of ChocolateNew YorkSteve PKD-4872Chocolate652820The Candy ShopBaltimoreTim PED-9283 Cinnamon 746538 Jim’s Candies Dallas Karen

11 IFS180: Intro. to Data Management Validate 3NF Place functional dependency columns into their own relationship New relationship will have a PK = determinant of functional dependency Original relationship will contain the determinate New relation and Original relation will have a referential integrity constraint

12 IFS180: Intro. to Data Management Ensuring a sound database structure Column (Field Names) Descriptive and meaningful to entire organization Clear and unambiguous Use of acronyms or abbreviation Implicitly or explicitly identify more than one characteristic

13 IFS180: Intro. to Data Management Order Number Gender Address City State Zip Code Phone Number Name Quantity Cost PARTNO ACTNO SSID UoM / UoP / UoS BoL CofA BOM Order DT SAL ST Why were these shortcuts taken ???

14 IFS180: Intro. to Data Management Additional Considerations Singular form column names Column Name identifies characteristics of table (3NF violation) Column only contains a single value 641 W. Main St Ephrata PA 17522 55 Northview Dr. Lancaster PA 17601 Helps to assure data integrity and accuracy How would these single values be resolved?

15 IFS180: Intro. to Data Management Additional Considerations Make sure field does not store results of calculations Many violations occur here in the name of performance. Selling Price Labor Cost OVHD Cost Quantity On-Order Account Balance Quantity On-Hand Material Cost Y-T-D Usage P.O. Cost Hours Worked

16 IFS180: Intro. to Data Management Additional Considerations Multipart Column values (pg 26) Instrument ID GUIT2201 (From experience) Part Number 21-1000 Resolving multi-value columns Break into separate fields in separate tables (and possibly) add a linking table (pg 28)

17 IFS180: Intro. to Data Management Fine tuning tables Table should represent a single subject Unique name and descriptive to entire org. Is table name accurate, clear and unambiguous Does table name convey physical characteristics Does table name contain acronyms or abbreviations Does table name identify more than one subject

18 IFS180: Intro. to Data Management Ensuring sound table structure (Again) Table represents a single subject (object or event) Each table has a PK No duplicate values (violation of 3NF). Table contains only functionally dependent columns

19 IFS180: Intro. to Data Management Key Field Considerations Simple PK vs Composite PK Uniquely ID’s each row Unique values enforce integrity Will the field ever contain duplicates Can field value be optional Multipart field (should have been eliminated) Can the value be modified ** Remain Static **


Download ppt "IFS180: Intro. to Data Management Chapter 2 Ensuring your database structure is sound."

Similar presentations


Ads by Google