Database Normalization Raymond Mark/Learn iT! Incorporated.
-
Upload
dorthy-fields -
Category
Documents
-
view
214 -
download
0
Transcript of Database Normalization Raymond Mark/Learn iT! Incorporated.
Database NormalizationDatabase NormalizationRaymond Mark/Learn iT! IncorporatedRaymond Mark/Learn iT! Incorporated
What Is Normalization?What Is Normalization?
Process of modifying a database into Process of modifying a database into different normal forms (stages of different normal forms (stages of normalization)normalization)
Process of organizing data to eliminate Process of organizing data to eliminate repetitionrepetition
Process of organizing data to make a Process of organizing data to make a database more efficientdatabase more efficient
Normal FormsNormal Forms
First Normal FormFirst Normal Form Flat file tablesFlat file tables No field repetitionNo field repetition
Second Normal FormSecond Normal Form Meets all First Normal Form requirementsMeets all First Normal Form requirements Non-key attributes are functionally dependent Non-key attributes are functionally dependent
on primary keyon primary key
Normal FormsNormal Forms
Third Normal FormThird Normal Form(Boyce-Codd Normal Form, BCNF)(Boyce-Codd Normal Form, BCNF) Meets all Second Normal Form requirementsMeets all Second Normal Form requirements Eliminates all fields not fully dependent on the Eliminates all fields not fully dependent on the
primary key fieldprimary key field
Normal FormsNormal Forms
Fourth Normal FormFourth Normal Form Meets all Third Normal Form requirementsMeets all Third Normal Form requirements Given relation may not contain more than one Given relation may not contain more than one
multivalued attributemultivalued attribute
Fifth Normal FormFifth Normal Form Meets all Third Normal Form requirementsMeets all Third Normal Form requirements Contains data that enables reconstruction of Contains data that enables reconstruction of
original data sourceoriginal data source
Database Design GuidelinesDatabase Design Guidelines
Spend the bulk of your effort on table and Spend the bulk of your effort on table and relational designrelational designConsider the tradeoff between Consider the tradeoff between normalization rules and actual data usagenormalization rules and actual data usageEstablish table objects and relationships Establish table objects and relationships before creating other MS Access objectsbefore creating other MS Access objectsUse consistent naming conventionsUse consistent naming conventionsTest your objects and design before fully Test your objects and design before fully populating tablespopulating tables
Normalizing GuidelinesNormalizing Guidelines
Make Your Data AtomicMake Your Data Atomic
Avoid Field RepetitionAvoid Field Repetition
Avoid Data RepetitionAvoid Data Repetition
Make Primary Keys Short and StableMake Primary Keys Short and Stable
Maintain Table RelevanceMaintain Table Relevance
Maintain Field IndependenceMaintain Field Independence
Rule 1: Make Your Data AtomicRule 1: Make Your Data Atomic
Break the data into fields that are as small Break the data into fields that are as small as usably possibleas usably possible
It’s easier to search for information when It’s easier to search for information when the data are in their own fieldsthe data are in their own fields
In MS Access, it’s easier to fuse two In MS Access, it’s easier to fuse two pieces of data into one than the other way pieces of data into one than the other way aroundaround
Rule 1: Make Your Data AtomicRule 1: Make Your Data Atomic
strNamestrName strAddressstrAddress
Isabelle RingingIsabelle Ringing 10 Main Street10 Main Street
Boston, MA 02134Boston, MA 02134
Johnny Walker-Johnny Walker-BlackBlack
2588 California Street2588 California Street
San Francisco, CA 94109San Francisco, CA 94109
strFNamestrFName strLNamestrLName strStreetstrStreet strCitystrCity strStatestrState strZIPstrZIP
IsabelleIsabelle RingingRinging 10 Main 10 Main StreetStreet
BostonBoston MAMA 0213402134
JohnnyJohnny Walker-Walker-BlackBlack
2588 2588 California California StreetStreet
San San FranciscoFrancisco
CACA 9410994109
Rule 2: Avoid Field RepetitionRule 2: Avoid Field Repetition
This rule helps to achieveThis rule helps to achieveFirst Normal FormFirst Normal Form
In most cases of field repetition, the In most cases of field repetition, the number of fields that may eventually be number of fields that may eventually be required is usually unknown.required is usually unknown.
Rule 2: Avoid Field RepetitionRule 2: Avoid Field Repetition
Fields that are repeated may make you set Fields that are repeated may make you set aside memory that you never fill with dataaside memory that you never fill with data
Fields that are repeated have to be Fields that are repeated have to be searched on individually, increasing the searched on individually, increasing the demands on a data searchdemands on a data search
Separate repeating fields into their own Separate repeating fields into their own table, unifying the fields in the processtable, unifying the fields in the process
Rule 2: Avoid Field RepetitionRule 2: Avoid Field Repetition
lngInvNolngInvNo dtmDatedtmDate strItem01strItem01 intQnt0intQnt011
strItem02strItem02 intQnt0intQnt022
strItem03strItem03 intQnt03intQnt03
778309778309 05/10/0205/10/02 StaplesStaples(case)(case)
2020 Board FluidBoard Fluid
(6 oz.)(6 oz.)
1515
778310778310 05/10/0205/10/02 PencilsPencils
(dozen)(dozen)
1010 Binder ClipsBinder Clips
(case)(case)
1010 Coffee Coffee MugsMugs
66
778311778311 05/11/0205/11/02 Coffee Coffee MugsMugs
1010
Rule 2: Avoid Field RepetitionRule 2: Avoid Field Repetition
lngInvNolngInvNo dtmDatedtmDate
778309778309 05/10/0205/10/02
778310778310 05/10/0205/10/02
778311778311 05/11/0205/11/02
lngInvNolngInvNo strItemstrItem intQuantityintQuantity
778309778309 Staples (case)Staples (case) 2020
778309778309 Board Fluid (6 oz.)Board Fluid (6 oz.) 1515
778310778310 Pencils (dozen)Pencils (dozen) 1010
778310778310 Binder Clips Binder Clips (case)(case)
1010
778310778310 Coffee MugsCoffee Mugs 66
778311778311 Coffee MugsCoffee Mugs 1010
Rule 2: Avoid Field RepetitionRule 2: Avoid Field Repetition
lngInvNolngInvNoPKPK dtmDatedtmDate
778309778309 05/10/0205/10/02
778310778310 05/10/0205/10/02
778311778311 05/11/0205/11/02
lngInvNolngInvNoFKFK strItemstrItem intQuantityintQuantity
778309778309 Staples (case)Staples (case) 2020
778309778309 Board Fluid (6 oz.)Board Fluid (6 oz.) 1515
778310778310 Pencils (dozen)Pencils (dozen) 1010
778310778310 Binder Clips Binder Clips (case)(case)
1010
778310778310 Coffee MugsCoffee Mugs 66
778311778311 Coffee MugsCoffee Mugs 1010
Rule 3: Avoid Data RepetitionRule 3: Avoid Data Repetition
This rule helps to achieveThis rule helps to achieveSecond Normal FormSecond Normal Form
When data entry is repeated, it’s an When data entry is repeated, it’s an indication that the information should be indication that the information should be consolidated into a single reference pointconsolidated into a single reference point
The reference point for the consolidated The reference point for the consolidated data is that row’s data is that row’s Primary KeyPrimary Key
Rule 3: Avoid Data RepetitionRule 3: Avoid Data Repetition
strFNamestrFName strLNamestrLName strStreetstrStreet strCitystrCity strStatestrState strZIPstrZIP sngHrssngHrs dtmDatedtmDate
IsabelleIsabelle RingingRinging 10 Main Street10 Main Street BostonBoston MAMA 0213402134 5.55.5 05/01/0205/01/02
AnitaAnita ManhattanManhattan 2588 Pine Street2588 Pine Street OaklandOakland CACA 9410994109 7.07.0 05/04/0205/04/02
HarryHarry ArmpitsArmpits 452 Dove Road452 Dove Road BostonBoston MAMA 0213402134 6.06.0 05/08/0205/08/02
MonaMona LottLott 98 Kelly Place98 Kelly Place ChicagoChicago ILIL 6061460614 6.56.5 05/08/0205/08/02
BenBen DoverDover 55 Willow Avenue55 Willow Avenue ChicagoChicago ILIL 6061460614 7.57.5 05/10/0205/10/02
IsabelleIsabelle RingingRinging 10 Main Street10 Main Street BostonBoston MAMA 0213402134 6.06.0 05/11/0205/11/02
MonaMona LottLott 98 Kelly Place98 Kelly Place ChicagoChicago ILIL 6061460614 5.05.0 05/11/0205/11/02
BenBen DoverDover 55 Willow Avenue55 Willow Avenue ChicagoChicago ILIL 6061460614 7.57.5 05/11/0205/11/02
AnitaAnita ManhattanManhattan 2588 Pine Street2588 Pine Street OaklandOakland CACA 9410994109 6.56.5 05/14/0205/14/02
HarryHarry ArmpitsArmpits 452 Dove Road452 Dove Road BostonBoston MAMA 0213402134 6.56.5 05/15/0205/15/02
Rule 3: Avoid Data RepetitionRule 3: Avoid Data RepetitionstrFNamestrFName strLNamestrLName strStreetstrStreet strCitystrCity strStatestrState strZIPstrZIP
IsabelleIsabelle RingingRinging 10 Main Street10 Main Street BostonBoston MAMA 0213402134
AnitaAnita ManhattanManhattan 2588 Pine Street2588 Pine Street OaklandOakland CACA 9410994109
HarryHarry ArmpitsArmpits 452 Dove Road452 Dove Road BostonBoston MAMA 0213402134
MonaMona LottLott 98 Kelly Place98 Kelly Place ChicagoChicago ILIL 6061460614
BenBen DoverDover 55 Willow Avenue55 Willow Avenue ChicagoChicago ILIL 6061460614
strIDPKstrIDPK
IR255IR255
AM892AM892
HA883HA883
ML556ML556
BD418BD418
strIDFKstrIDFK sngHrssngHrs dtmDatedtmDate
IRIR 5.55.5 05/01/0205/01/02
AMAM 7.07.0 05/04/0205/04/02
HAHA 6.06.0 05/08/0205/08/02
MLML 6.56.5 05/08/0205/08/02
BDBD 7.57.5 05/10/0205/10/02
IRIR 6.06.0 05/11/0205/11/02
MLML 5.05.0 05/11/0205/11/02
BDBD 7.57.5 05/11/0205/11/02
AMAM 6.56.5 05/14/0205/14/02
HAHA 6.56.5 05/15/0205/15/02
Rule 3: Avoid Data RepetitionRule 3: Avoid Data RepetitionstrFNamestrFName strLNamestrLName strStreetstrStreet strZIPstrZIP
IsabelleIsabelle RingingRinging 10 Main Street10 Main Street 0213402134
AnitaAnita ManhattanManhattan 2588 Pine Street2588 Pine Street 9410994109
HarryHarry ArmpitsArmpits 452 Dove Road452 Dove Road 0213402134
MonaMona LottLott 98 Kelly Place98 Kelly Place 6061460614
BenBen DoverDover 55 Willow Avenue55 Willow Avenue 6061460614
strIDPKstrIDPK
IR255IR255
AM892AM892
HA883HA883
ML556ML556
BD418BD418
strIDFKstrIDFK sngHrssngHrs dtmDatedtmDate
IRIR 5.55.5 05/01/0205/01/02
AMAM 7.07.0 05/04/0205/04/02
HAHA 6.06.0 05/08/0205/08/02
MLML 6.56.5 05/08/0205/08/02
BDBD 7.57.5 05/10/0205/10/02
IRIR 6.06.0 05/11/0205/11/02
MLML 5.05.0 05/11/0205/11/02
BDBD 7.57.5 05/11/0205/11/02
AMAM 6.56.5 05/14/0205/14/02
HAHA 6.56.5 05/15/0205/15/02
strZIPstrZIP strCitystrCity strStatestrState
0213402134 BostonBoston MAMA
9410994109 OaklandOakland CACA
6061460614 ChicagoChicago ILIL
Rule 4: Make Primary KeysRule 4: Make Primary KeysShort and StableShort and Stable
Primary Keys should be short because Primary Keys should be short because they are used for searching through they are used for searching through records and identifying datarecords and identifying data
Primary Keys should be stable because Primary Keys should be stable because changes made to Primary Key data have changes made to Primary Key data have to be propagated to matching Foreign to be propagated to matching Foreign Keys Keys
Rule 5: Maintain Table RelevanceRule 5: Maintain Table RelevanceRule 6: Maintain Field IndependenceRule 6: Maintain Field Independence
These rule helps to achieveThese rule helps to achieveThird Normal FormThird Normal Form
Each of your tables should represent a Each of your tables should represent a single entity, that is, provide information on single entity, that is, provide information on a single subjecta single subject
The entity should be represented by a The entity should be represented by a primary keyprimary key
Rule 5: Maintain Table RelevanceRule 5: Maintain Table RelevanceRule 6: Maintain Field IndependenceRule 6: Maintain Field Independence
strFNamestrFName strLNamestrLName strCompanystrCompany strWebsitestrWebsite
IsabelleIsabelle RingingRinging Hollister IndustriesHollister Industries http://www.hollister.comhttp://www.hollister.com
AnitaAnita ManhattanManhattan Pinkerton SmithPinkerton Smith http://www.pinksmith.comhttp://www.pinksmith.com
HarryHarry ArmpitsArmpits Donovan CompanyDonovan Company http://www.donovan.orghttp://www.donovan.org
MonaMona LottLott Tyler FlynnTyler Flynn http://www.tylerflynn.comhttp://www.tylerflynn.com
strFNamestrFName strLNamestrLName
IsabelleIsabelle RingingRinging
AnitaAnita ManhattanManhattan
HarryHarry ArmpitsArmpits
MonaMona LottLott
strCompanystrCompany strWebsitestrWebsite
Hollister IndustriesHollister Industries http://www.hollister.comhttp://www.hollister.com
Pinkerton SmithPinkerton Smith http://www.pinksmith.comhttp://www.pinksmith.com
Donovan CompanyDonovan Company http://www.donovan.orghttp://www.donovan.org
Tyler FlynnTyler Flynn http://www.tylerflynn.comhttp://www.tylerflynn.com
strIDstrID
IR255IR255
AM892AM892
HA883HA883
ML556ML556
strCompanystrCompany
Hollister IndustriesHollister Industries
Pinkerton SmithPinkerton Smith
Donovan CompanyDonovan Company
Tyler FlynnTyler Flynn