Download presentation
Presentation is loading. Please wait.
Published byDarleen Webster Modified over 9 years ago
1
Agenda and Objectives Agenda ▫Examine normalized and non-normalized ERDs/Tables Objectives ▫Given an ERD, you will be able to determine whether or not it is in 3NF. ▫Given a non-normalized ERD (or database table), you will be able to revise it to make it 3NF compliant. Resource ▫Normalized_ERDs.pptx
2
Normalizing Your Database Model IS 310 Dr. Jean A. Pratt
3
Related Terminology Normalization First Normal Form (1NF) Second Normal Form (2NF) Third Normal Form (3NF) 1NF: No repeating groups; 1 value/cell 2NF: No partial dependencies 3NF: No transitive dependencies
4
First Normal Form (1NF) Only those attributes that describe the entity are included in that entity Each entity has a primary key (PK) Each attribute is the smallest unit that would be included in a query Data is not repeated in different entities Each attribute would contain a single value in the database table cell Redundant data is minimized
5
Multivalued Attributes: AVOID Multivalued attribute ▫An attribute that may take on more than one value for each entity instance Examples Skill is a multivalued attribute of Employee Color may be a multivalued attribute of ToyBlock Dependent is a multivalued attribute of Employee Phone/fax number is a multivalued attribute of Employee Repeating group ▫A set of multivalued attributes that are logically related—associated with the same entity instance Dependent address for each dependent of employee
6
Example of (almost) 1NF ERD Note that we will still have redundant data (although not multivalued) if students live at the same address. We’ll want to remove that redundancy later.
7
Resulting 1NF Table STUDENT Student_IDFirst NameLast NameStreetCityStateZipPhone 12345JoeJohnson1234 MainEau ClaireWI54703715-123-1234 23435SallyShue7484 MainAltoonaWI54720715-333-2111 23424MollyMae2342 MainMondoviWI54755715-324-7878 12346JillJohnson1234 MainEau ClaireWI54703715-123-1234 12347JoeJohnson9898 GrandeElk MoundWI54739715-999-8888
8
How to Correct Multivalued or Repeating Attributes 1.Create new entity 2.New entity could be weak/dependent/identifying 3.New entity could independent
9
Multivalued Attributes: Table Add rows, not columns PHONE Emp IDPhone NumberType 10715-123-1234H 10715-123-4567C 14715-123-1234H 14715-123-6789C 14715-123-1111O 14715-123-2222F 16715-123-4545O
10
Identify & Name the 1NF Violations
11
Resulting Table STUDENT Student Name AddressEmergency Contact Info Joe Johnson1234 Main, Eau Claire, WI 54703Herbert and Gertrude Johnson, 1234 Main, Eau Claire, WI 54703 715-123- 1234 Sally Shue7484 Main, Altoona, WI 54720Simon and Susan Shue, 7484 Main, Altoona, WI 54720 715-333-2111 Molly Mae2342 Main, Mondovi, WI 54755Albert and Alfreda Mae, 2342 Main, Mondovi, WI 54755, 715-324-7878 Jill Johnson1234 Main, Eau Claire, WI 54703Herbert and Gertrude Johnson, 1234 Main, Eau Claire, WI 54703 715-123- 1234 Joe Johnson9898 Grande, Elk Mound, WI 54739Louise Johnson, 9898 Grande, Elk Mound, WI 54739 715-999-8888
12
Identify & Name the 1NF Violations
13
Resulting Table STUDENT Student_IDFirst NameLast NameStreetCityStateZipEmerg Phone ClassesGradesSports & Activities Position 12345JoeJohnson1234 MainEau ClaireWI54703715-123- 1234 Biology, English, Algebra A, B, BFootball, Basketball, Baseball, Choir, Tennis QB, Bass, #1 Doubles 23435SallyShue7484 MainAltoonaWI54720715-333- 2111 Biology, English, Algebra B, B, ADebate, Band, Tennis Parliament ary, 1 st Flute, #1 Doubles 23424MollyMae2342 MainMondoviWI54755715-324- 7878 Chemistry, Art, Math A, B, A, BSpeechImpromptu 12346JillJohnson1234 MainEau ClaireWI54703715-123- 1234 Algebra, English, Art A, A, Chess, Tennis President, #1 Singles 12347JoeJohnson9898 Grande Elk MoundWI54739715-999- 8888 Math, Trigonomet ry, Chemistry A, A, AChess,VP, #1 Singles
14
Is This a Good Solution?
15
Resulting Table STUDENT Student_ID First Name Last Name Class 1Grade 1Class 2Grade 2Class 3Grade 3Sport/A ctivity 1 PositionSport/A ctivity 2 PositionSport/A ctivity 3 Position 12345JoeJohnsonBiologyAEnglishBAlgebraBFootballQBChoirBassTennis#1 Doubles 23435SallyShueBiologyBEnglishBAlgebraADebateParliam entary Band1 st FluteTennis#1 Doubles 23424MollyMaeChemist ry AArtBMathASpeechImprom ptu 12346JillJohnsonAlgebraAEnglishAArtAChessPreside nt Tennis#1 Single 12347JoeJohnsonMathATrigono metry AChemist ry AChessVP
16
How would you Solve This Problem? EMPLOYEE Emp_IDFnameLnameDependent1Dependent2Dependent3 1JoeJohnsonJohnnyJane 2MaryZabowskiElizabethMadisonLogan 3JoeyChoAnnie 4EllenMaffeyRobertBlaine What about employees with more than 3 children?
17
Second Normal Form (2NF) Entities meet 1NF requirements PLUS All attributes are functionally dependent upon the entire primary key.
18
Identify & Name the 2NF Violations
19
Resulting Table STUDENT Student_IDFirst NameLast NameClassGradesSport or Activity Position 12345JoeJohnsonBiologyAFootballQB 12345JoeJohnsonEnglishBBasketballGuard 12345JoeJohnsonAlgebraBBaseballCatcher 12345JoeJohnsonChoirBass 12345JoeJohnsonTennis#1 Doubles 23424MollyMaeChemistryASpeechImpromptu 23424MollyMaeArtB 23424MollyMaeMathA
20
Third Normal Form (3NF) Violation Entities meet 2NF requirements BUT One non-key attribute determines another non- key attribute
21
Completed 3NF ERD
22
What are the Values for the Associative Entities?
23
Resulting Relations STUDENT Student_ID First NameLast NameAdd_IDPhoneGuardian_ID 12345JoeJohnson1715-123-12341 23435SallyShue2715-333-21112 23424MollyMae3715-324-78783 12346JillJohnson1715-123-12341 12347JoeJohnson4715-999-88884 CLASS Class_IDName 10Biology 20English 30Algebra 40Chemistry 50Math 60Art 70Trigonometry 80History 90Geography SPORT/ ACTIVITY Event_IDName 100Football 101Debate 102Speech 103Chess 104Choir 105Band 106Basketball 107Tennis 108Baseball 109Hockey ENROLLMENT Enrollment_IDYearSemesterGradeClass_IDStudent_ID 111112007FallB-3023424 111122007FallF3012346 111132007FallA6012346 111142008SpringB+8012345 111152008SpringC3012346 1111520008SpringB9012345 PARTICIPATION PartIDPositionStudent_IDEvent_ID 2222 nd Singles23424107 223Guard12346106 224Alto12346104 225QB12345100 226Forensics12346101 227Forensics12345101 2281 st Doubles23435107 2291 st Doubles23424107 ADDRESS Add_IDZipStateCityStreet 154703WIEau Claire1234 Main 254720WIAltoona7484 Main 354755WIMondovi2342 Main 454739WIElk Mound9898 Grande GUARDIAN Guardian_ID First NameLast NameAdd_IDPhone 1HerbertJohnson1715-123-1234 2SimonShue2715-333-2111 3AlbertMae3715-324-7878 4LouiseJohnson1715-999-8888
24
Review Know the difference between 1NF, 2NF and 3NF Ensure your ERD (and resulting database) is in at least 2NF 3NF is the standard (with purposeful violations based on performance)
25
Application to Your Project Define the necessary tables from every DFD data store Create an ERD to model the data storage Normalize the ERD to 3NF Create mock-up relations to test your model Include the ERD and mock-up relations in your final project documentation
26
Data Modeling Practice 1.A vendor supplies many products. 2.A product is supplied by many vendors. 3.A customer buys one or more products. 4.Each product can be purchased by many customers. 5.An employee can help many customers. 6.A customer is helped by one or more employees. 7.Each employee works in one department. 8.A department has many employees (working in it). 9.Each department is part of many stores. 10.Each store contains many departments. Scenario: Chain stores (e.g., Target) that contain several departments and sell many products to many customers.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.