Agenda and Objectives
description
Transcript of Agenda and Objectives
![Page 1: Agenda and Objectives](https://reader036.fdocuments.in/reader036/viewer/2022081512/56816140550346895dd0ad4c/html5/thumbnails/1.jpg)
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
![Page 2: Agenda and Objectives](https://reader036.fdocuments.in/reader036/viewer/2022081512/56816140550346895dd0ad4c/html5/thumbnails/2.jpg)
Normalizing Your Database ModelIS 310Dr. Jean A. Pratt
![Page 3: Agenda and Objectives](https://reader036.fdocuments.in/reader036/viewer/2022081512/56816140550346895dd0ad4c/html5/thumbnails/3.jpg)
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
![Page 4: Agenda and Objectives](https://reader036.fdocuments.in/reader036/viewer/2022081512/56816140550346895dd0ad4c/html5/thumbnails/4.jpg)
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
![Page 5: Agenda and Objectives](https://reader036.fdocuments.in/reader036/viewer/2022081512/56816140550346895dd0ad4c/html5/thumbnails/5.jpg)
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
![Page 6: Agenda and Objectives](https://reader036.fdocuments.in/reader036/viewer/2022081512/56816140550346895dd0ad4c/html5/thumbnails/6.jpg)
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.
![Page 7: Agenda and Objectives](https://reader036.fdocuments.in/reader036/viewer/2022081512/56816140550346895dd0ad4c/html5/thumbnails/7.jpg)
Resulting 1NF Table
STUDENTStudent_ID First Name Last Name Street City State Zip Phone12345 Joe Johnson 1234 Main Eau Claire WI 54703 715-123-1234
23435 Sally Shue 7484 Main Altoona WI 54720 715-333-2111
23424 Molly Mae 2342 Main Mondovi WI 54755 715-324-7878
12346 Jill Johnson 1234 Main Eau Claire WI 54703 715-123-1234
12347 Joe Johnson 9898 Grande Elk Mound WI 54739 715-999-8888
![Page 8: Agenda and Objectives](https://reader036.fdocuments.in/reader036/viewer/2022081512/56816140550346895dd0ad4c/html5/thumbnails/8.jpg)
How to Correct Multivalued or Repeating Attributes1. Create new entity2. New entity could be
weak/dependent/identifying3. New entity could independent
![Page 9: Agenda and Objectives](https://reader036.fdocuments.in/reader036/viewer/2022081512/56816140550346895dd0ad4c/html5/thumbnails/9.jpg)
Multivalued Attributes: Table•Add rows, not columnsPHONEEmp ID Phone Number Type10 715-123-1234 H10 715-123-4567 C14 715-123-1234 H14 715-123-6789 C14 715-123-1111 O14 715-123-2222 F16 715-123-4545 O
![Page 10: Agenda and Objectives](https://reader036.fdocuments.in/reader036/viewer/2022081512/56816140550346895dd0ad4c/html5/thumbnails/10.jpg)
Identify & Name the 1NF Violations
![Page 11: Agenda and Objectives](https://reader036.fdocuments.in/reader036/viewer/2022081512/56816140550346895dd0ad4c/html5/thumbnails/11.jpg)
Resulting Table
STUDENTStudent Name Address Emergency Contact InfoJoe Johnson 1234 Main, Eau Claire, WI 54703 Herbert and Gertrude Johnson, 1234
Main, Eau Claire, WI 54703 715-123-1234
Sally Shue 7484 Main, Altoona, WI 54720 Simon and Susan Shue, 7484 Main, Altoona, WI 54720 715-333-2111
Molly Mae 2342 Main, Mondovi, WI 54755 Albert and Alfreda Mae, 2342 Main, Mondovi, WI 54755, 715-324-7878
Jill Johnson 1234 Main, Eau Claire, WI 54703 Herbert and Gertrude Johnson, 1234 Main, Eau Claire, WI 54703 715-123-1234
Joe Johnson 9898 Grande, Elk Mound, WI 54739 Louise Johnson, 9898 Grande, Elk Mound, WI 54739 715-999-8888
![Page 12: Agenda and Objectives](https://reader036.fdocuments.in/reader036/viewer/2022081512/56816140550346895dd0ad4c/html5/thumbnails/12.jpg)
Identify & Name the 1NF Violations
![Page 13: Agenda and Objectives](https://reader036.fdocuments.in/reader036/viewer/2022081512/56816140550346895dd0ad4c/html5/thumbnails/13.jpg)
Resulting TableSTUDENT
Student_ID First Name Last Name Street City State Zip Emerg Phone
Classes Grades Sports & Activities
Position
12345 Joe Johnson 1234 Main Eau Claire WI 54703 715-123-1234
Biology, English, Algebra
A, B, B Football, Basketball, Baseball, Choir, Tennis
QB, Bass, #1 Doubles
23435 Sally Shue 7484 Main Altoona WI 54720 715-333-2111
Biology, English, Algebra
B, B, A Debate, Band, Tennis
Parliamentary, 1st Flute, #1 Doubles
23424 Molly Mae 2342 Main Mondovi WI 54755 715-324-7878
Chemistry, Art, Math
A, B, A, B Speech Impromptu
12346 Jill Johnson 1234 Main Eau Claire WI 54703 715-123-1234
Algebra, English, Art
A, A, A, A, Chess, Tennis
President, #1 Singles
12347 Joe Johnson 9898 Grande
Elk Mound WI 54739 715-999-8888
Math, Trigonometry, Chemistry
A, A, A Chess, VP, #1 Singles
![Page 14: Agenda and Objectives](https://reader036.fdocuments.in/reader036/viewer/2022081512/56816140550346895dd0ad4c/html5/thumbnails/14.jpg)
Is This a Good Solution?
![Page 15: Agenda and Objectives](https://reader036.fdocuments.in/reader036/viewer/2022081512/56816140550346895dd0ad4c/html5/thumbnails/15.jpg)
Resulting TableSTUDENTStudent_ID First
NameLast Name
Class 1 Grade 1 Class 2 Grade 2 Class 3 Grade 3 Sport/Activity 1
Position Sport/Activity 2
Position Sport/Activity 3
Position
12345 Joe Johnson Biology A English B Algebra B Football QB Choir Bass Tennis #1 Doubles
23435 Sally Shue Biology B English B Algebra A Debate Parliamentary
Band 1st Flute Tennis #1 Doubles
23424 Molly Mae Chemistry
A Art B Math A Speech Impromptu
12346 Jill Johnson Algebra A English A Art A Chess President
Tennis #1 Single
12347 Joe Johnson Math A Trigonometry
A Chemistry
A Chess VP
![Page 16: Agenda and Objectives](https://reader036.fdocuments.in/reader036/viewer/2022081512/56816140550346895dd0ad4c/html5/thumbnails/16.jpg)
How would you Solve This Problem?EMPLOYEEEmp_ID Fnam
eLname Dependent
1Dependent2
Dependent3
1 Joe Johnson Johnny Jane2 Mary Zabows
kiElizabeth Madison Logan
3 Joey Cho Annie4 Ellen Maffey Robert Blaine
What about employees with more than 3 children?
![Page 17: Agenda and Objectives](https://reader036.fdocuments.in/reader036/viewer/2022081512/56816140550346895dd0ad4c/html5/thumbnails/17.jpg)
Second Normal Form (2NF)•Entities meet 1NF requirements PLUS•All attributes are functionally dependent
upon the entire primary key.
![Page 18: Agenda and Objectives](https://reader036.fdocuments.in/reader036/viewer/2022081512/56816140550346895dd0ad4c/html5/thumbnails/18.jpg)
Identify & Name the 2NF Violations
![Page 19: Agenda and Objectives](https://reader036.fdocuments.in/reader036/viewer/2022081512/56816140550346895dd0ad4c/html5/thumbnails/19.jpg)
Resulting TableSTUDENTStudent_ID First Name Last Name Class Grades Sport or
ActivityPosition
12345 Joe Johnson Biology A Football QB12345 Joe Johnson English B Basketball Guard12345 Joe Johnson Algebra B Baseball Catcher12345 Joe Johnson Choir Bass12345 Joe Johnson Tennis #1 Doubles23424 Molly Mae Chemistry A Speech Impromptu23424 Molly Mae Art B23424 Molly Mae Math A
![Page 20: Agenda and Objectives](https://reader036.fdocuments.in/reader036/viewer/2022081512/56816140550346895dd0ad4c/html5/thumbnails/20.jpg)
Third Normal Form (3NF) Violation•Entities meet 2NF requirements BUT•One non-key attribute determines another
non-key attribute
![Page 21: Agenda and Objectives](https://reader036.fdocuments.in/reader036/viewer/2022081512/56816140550346895dd0ad4c/html5/thumbnails/21.jpg)
Completed 3NF ERD
![Page 22: Agenda and Objectives](https://reader036.fdocuments.in/reader036/viewer/2022081512/56816140550346895dd0ad4c/html5/thumbnails/22.jpg)
What are the Values for the Associative Entities?
![Page 23: Agenda and Objectives](https://reader036.fdocuments.in/reader036/viewer/2022081512/56816140550346895dd0ad4c/html5/thumbnails/23.jpg)
Resulting Relations
STUDENTStudent_ID First Name Last Name Add_ID Phone Guardian_ID12345 Joe Johnson 1 715-123-1234 123435 Sally Shue 2 715-333-2111 223424 Molly Mae 3 715-324-7878 312346 Jill Johnson 1 715-123-1234 112347 Joe Johnson 4 715-999-8888 4
CLASSClass_ID Name10 Biology20 English30 Algebra40 Chemistry50 Math60 Art70 Trigonometry80 History90 GeographySPORT/
ACTIVITYEvent_ID Name100 Football 101 Debate 102 Speech103 Chess104 Choir105 Band106 Basketball107 Tennis108 Baseball109 Hockey
ENROLLMENTEnrollment_ID Year Semester Grade Class_ID Student_ID11111 2007 Fall B- 30 2342411112 2007 Fall F 30 1234611113 2007 Fall A 60 1234611114 2008 Spring B+ 80 1234511115 2008 Spring C 30 1234611115 20008 Spring B 90 12345
PARTICIPATIONPartID Position Student_ID Event_ID222 2nd Singles 23424 107223 Guard 12346 106224 Alto 12346 104225 QB 12345 100226 Forensics 12346 101227 Forensics 12345 101228 1st Doubles 23435 107229 1st Doubles 23424 107
ADDRESSAdd_ID Zip State City Street1 54703 WI Eau Claire 1234 Main2 54720 WI Altoona 7484 Main3 54755 WI Mondovi 2342 Main4 54739 WI Elk Mound 9898 Grande
GUARDIANGuardian_ID First Name Last Name Add_ID Phone1 Herbert Johnson 1 715-123-12342 Simon Shue 2 715-333-21113 Albert Mae 3 715-324-78784 Louise Johnson 1 715-999-8888
![Page 24: Agenda and Objectives](https://reader036.fdocuments.in/reader036/viewer/2022081512/56816140550346895dd0ad4c/html5/thumbnails/24.jpg)
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)
![Page 25: Agenda and Objectives](https://reader036.fdocuments.in/reader036/viewer/2022081512/56816140550346895dd0ad4c/html5/thumbnails/25.jpg)
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
![Page 26: Agenda and Objectives](https://reader036.fdocuments.in/reader036/viewer/2022081512/56816140550346895dd0ad4c/html5/thumbnails/26.jpg)
Data Modeling Practice1. 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.