Presentation is loading. Please wait.

Presentation is loading. Please wait.

Database Design 1 CMS 476 Fall 1, 2007 Dr. Karl Horak, Instructor.

Similar presentations


Presentation on theme: "Database Design 1 CMS 476 Fall 1, 2007 Dr. Karl Horak, Instructor."— Presentation transcript:

1 Database Design 1 CMS 476 Fall 1, 2007 Dr. Karl Horak, Instructor

2 Session 5 Week in Review Week in Review Application du Jour Application du Jour Lecture: Normalization Lecture: Normalization Demonstration: Modeling, cont. Demonstration: Modeling, cont. Exercises Exercises

3 Week in Review Cross-site scripting vulnerability Cross-site scripting vulnerability Visiting scholar returns home Visiting scholar returns home Oh, yes, and grading Oh, yes, and grading

4 Tonight’s Lecture Topic: Normalization Method 1 Method 1 Method 2 Method 2

5 The Daisy Hill Puppy Farm Puppy NameKennel NameKennel LocationTrick NameTrick Where LearnedSkill Level JunoCity PoundLawrence, KSComeHome2 Snoopy Daisy Hill Puppy Farm Anytown, USASit Daisy Hill Puppy Farm 5 Snoopy Daisy Hill Puppy Farm Anytown, USAStay Daisy Hill Puppy Farm 3 Snoopy Daisy Hill Puppy Farm Anytown, USA Flying a Sopwith Camel Charlie Brown's house 4

6 Method 1—The Old Way 1. Eliminate Repeating Groups 2. Eliminate Redundant Data 3. Remove Items Not Dependent On Key

7 Eliminate Repeating Groups Make a separate table for each set of related attributes, and give each table a primary key. How? Split the table into two tables: Puppy Table = Puppy Number + Puppy Name + Kennel Code + Kennel Name + Kennel Location Trick Table = Puppy Number + Trick ID + Trick Name + Trick Where Learned + Skill Level

8 Eliminate Redundant Data If an attribute depends on only part of a multi-valued key, remove it into a separate table. How? Split the Trick Table into two: Tricks and Puppy Tricks. Tricks = Trick ID + Trick Name Puppy Tricks = Puppy Number + Trick ID + Trick Where Learned + Skill Level Puppy Table = Puppy Number + Puppy Name + Kennel Code + Kennel Name + Kennel Location

9 Remove Items Not Dependent On Key Tricks = Trick ID + Trick Name Puppy Tricks = Puppy Number + Trick ID + Trick Where Learned + Skill Level Puppies = Puppy Number + Puppy Name + Kennel Code Kennels = Kennel Code + Kennel Name + Kennel Location If attributes do not contribute to a description of the key, remove them to a separate table. How? Split Puppy Table into two tables: Puppies and Kennels

10 Result Puppies PuppyTricksTricks Kennels

11 Method 2—New and Improved 1. Create Object-Role Model 2. Generate Entity-Relationship Diagram 3. Build database tables

12 Object-Role Model

13 Generate ER Diagram

14 Your Choice Method 1—Largely by inspection and following arcane rules. Method 1—Largely by inspection and following arcane rules. –Very difficult in complex situations –Easy to screw up Method 2—Model the objects and their roles, then let the machine do it. Method 2—Model the objects and their roles, then let the machine do it. –Requires additional software proficiency –Easy

15 Some More VM Tips File | Preferences to change “freeform” to “guided” for default Fact Editor screen File | Preferences to change “freeform” to “guided” for default Fact Editor screen Under Application tab, set to save before build Under Application tab, set to save before build Look at the documentation—excellent PDFs with real-world samples and explanations Look at the documentation—excellent PDFs with real-world samples and explanations

16 Demonstration Back to VisioModeler Back to VisioModeler The Daisy Hill Puppy Farm Example The Daisy Hill Puppy Farm Example

17 Exercises and Q&A Approaching a solution for HW #2 Approaching a solution for HW #2 –Scoping the problem –Core objects and verbs


Download ppt "Database Design 1 CMS 476 Fall 1, 2007 Dr. Karl Horak, Instructor."

Similar presentations


Ads by Google