Professional Documents
Culture Documents
2006.09.14 - SLIDE 1
Announcements
I will be away next week Instead we will have an informal workshop to work on issues of choosing and designing your personal Databases
2006.09.14 - SLIDE 2
Lecture Outline
Review
Conceptual Model and UML
Logical Model for the Diveshop database Normalization Relational Advantages and Disadvantages
IS 257 Fall 2006
2006.09.14 - SLIDE 3
Lecture Outline
Review Logical Design for the Diveshop database Normalization Relational Advantages and Disadvantages
2006.09.14 - SLIDE 4
DiveShop ER Diagram
Customer No Destination Name Destination no
DiveCust
1
Customer No
n n 1
ShipVia
Dest
Destination no Site No
1 1
DiveOrds
Order No
ShipVia
ShipVia
Destination
n
Sites
n 1 1/n
Order No Item No
Site No Species No
DiveItem
n
BioSite
n
ShipWrck
Site No
1 1
Species No
BioLife
DiveStok
Item No
2006.09.14 - SLIDE 5
Lecture Outline
Review
Conceptual Model and UML
Logical Model for the Diveshop database Normalization Relational Advantages and Disadvantages
IS 257 Fall 2006
2006.09.14 - SLIDE 6
External Model
Application 1
External Model
External Model
External Model
Conceptual requirements
Application 2
Conceptual requirements
Application 3
Conceptual requirements
Application 4
Conceptual Model
Logical Model
Internal Model
Conceptual requirements
2006.09.14 - SLIDE 7
2006.09.14 - SLIDE 8
DiveShop ER Diagram
Customer No Destination Name Destination no
DiveCust
1
Customer No
n n 1
ShipVia
Dest
Destination no Site No
1 1
DiveOrds
Order No
ShipVia
ShipVia
Destination
n
Sites
n 1 1/n
Order No Item No
Site No Species No
DiveItem
n
BioSite
n
ShipWrck
Site No
1 1
Species No
BioLife
DiveStok
Item No
2006.09.14 - SLIDE 9
Customer = DIVECUST
Customer No Name Street City State/Prov Zip/Postal Code Country 1480 Louis Jazdzewski 2501 O'Connor Orleans New LA 60332 U.S.A. 1481 Barbara Wright W. Freeway 6344 San Francisco CA 95031 U.S.A. 1909 Stephen Bredenburg 167 Place IN 559 N.E. Indianapolis 46241 U.S.A. 1913 Phillip Davoust First Street 123 Berkeley CA 94704 U.S.A. 1969 David Burgett Montgomery Street 320 Seattle WA 98105 U.S.A. 2001 Mary Rioux1701 Gateway Blvd. #385 Pueblo CO 81002 U.S.A. 2306 Kim Lopez 14134 Nottingham Lane Honolulu HI 96826 U.S.A. 2589 Hiram Marley Mill Run Drive CA 7233 San Francisco 94123 U.S.A. 3154 Tanya Kulesa S. Flower, Mail Stop 48943 10032 505 New York NY U.S.A. 3333 Charles Sekaron 110 East Park Avenue, Box 8 Miller SD 57362 U.S.A. 3684 Lowell Lutz915 E. Fesler Dallas TX 75043 U.S.A. 4158 Keith Lucas South Euclid 56 Chicago IL 60542 U.S.A. 4175 Karen Ng 2134 Elmhill Pike Falls Klamath OR 97603 U.S.A. 5510 Ken Soule 58 Sansome Street CO Aurora 89022 U.S.A. Phone First Contact (902) 555-8888 /29/95 1 (415) 555-43212/2/93 (317) 555-36441/5/93 (415) 555-91843/9/98 (206) 555-7580 /12/99 3 (719) 555-2010 /15/97 3 (808) 555-5050 /29/99 1 (415) 555-6430 /18/99 2 (212) 555-6750 /30/99 1 (613) 555-4333 /16/98 3 (214) 555-2722 /15/99 2 (312) 555-4310 /17/98 3 (503) 555-4700 /20/99 3 (303) 555-66952/5/99
2006.09.14 - SLIDE 10
2006.09.14 - SLIDE 11
Rental/Sale Qty Rental Rental Rental Rental Rental Rental Rental Rental Rental Rental Sale Rental Rental Rental Sale
Line Note 4 1 1 2 2 1 1 1 1 1 1 3 3 3 2 This is our most popular mask. These are our best selling fins.
2006.09.14 - SLIDE 12
Ship Cost 8 11 12 10 6
2006.09.14 - SLIDE 13
DescriptionEquipment On Hand Reorder Point Class Cost Sale Price Rental Price Shotgun 2 Snorkel - Clear 12 2 $18.00 $30.00 $2.00 Shotgun 2 Snorkel - Red 12 2 $18.00 $30.00 $2.00 Shotgun 2 Snorkel - Teal 11 2 $18.00 $30.00 $2.00 Tri-Vent Mask - Clear Mask 14 2 $62.50 $100.00 $5.00 Tri-Vent Mask - Red Mask 10 2 $62.50 $100.00 $5.00 Tri-Vent Mask - Teal Mask 14 2 $62.50 $100.00 $7.00 Quad Vision Mask - Clear Mask 11 2 $48.25 $80.00 $7.00 Quad Vision Mask - Red Mask 13 2 $48.25 $80.00 $7.00 Quad Vision Mask - Teal Mask 10 2 $48.25 $80.00 $10.00 Sea Wing Fins - Clear Fins 12 2 $60.00 $100.00 $12.00 Sea Wing Fins - Red Fins 11 2 $60.00 $100.00 $12.00 Sea Wing Fins - Teal Fins 12 2 $60.00 $100.00 $12.00 Jet Fin - Black Fins 14 2 $30.00 $60.00 $10.00 D350 Second Stage Regulator 11 1 $162.50 $270.00 $20.00 G250 Second Stage Regulator 13 1 $144.50 $240.00 $20.00 G200 Second Stage Regulator 12 1 $105.25 $175.00 $20.00
2006.09.14 - SLIDE 14
Destination No Destination Name Avg Temp Avg Temp Spring Temp (F) Temp (C) Temp (F) Temp Temp (F) Temp (C) (F) (C) Spring Summer Summer Fall (C) Fall Winter Temp (F) Temp (C) Winter Accomodations Life Night 1 Cozumel 78 25.556 76 24.444 84 28.889 78 25.556 74 23.333 Cheap Sleepy 2 Great Barrier Reef80 26.667 76 24.444 84 28.889 78 25.556 76 24.444 Moderate Pleasant 3 Monterey 60 15.556 62 16.667 64 17.778 64 17.778 58 14.444 Expensive Wild 4 Santa Barbara 75 23.889 73 22.777 78 25.556 72 22.222 70 21.111 Expensive Wild 5 Florida 77 25 75 23.889 85 29.444 78 25.556 70 21.111 Moderate Pleasant 6 Fiji 75 23.889 76 24.444 80 26.667 74 23.333 70 21.111 Expensive Sleepy 7 New Jersey 57 13.889 57 13.89 60 15.556 58 14.444 53 11.667 Expensive Pleasant
Body of Water Travel Cost Caribbean 1000 Coral Sea 5000 Pacific 2000 Pacific 3000 Caribbean 3000 South Pacific 5000 Atlantic 2000
2006.09.14 - SLIDE 15
Site No Destination No Name Site Site Highlight ite Notes from Depth (m) S Distance Distance from (ft)Depth (m) Visibility (ft)Visibility (m) Town Town (km) Current 1001 1 Palancar Reef Reef 10 16.09 100 30.48 150 45.72 Strong 1002 1 Santa Rosa Reef Reef 8 12.87 80 24.384 150 45.72 Strong 1003 1 Chancanab Reef eef R 4 6.437 60 18.288 100 30.48 Mild 1004 1 Punta Sur Reef 13 20.92 120 36.576 175 53.34 Strong 1005 1 Yocab Reef Reef 6 9.656 50 15.24 100 30.48 Mild 2001 2 Heron Island Reef 50 80.47 90 27.432 150 45.72 Mild 2002 2 Cod Hole Fish 45 72.42 50 15.24 150 45.72 Mild 2003 2 Butterfly Bay Caves 20 32.19 70 21.336 70 21.336 None 2004 2 Wheeler Reef Marine Life 30 48.28 50 15.24 125 38.1 Mild 2005 2 Watanabe Marine Life 130 209.2 150 45.72 200 60.96 None 3001 3 Point Lobos Marine Life 3 4.828 60 18.288 75 22.86 None 3002 3 Macabee BeachMarine Life 0.1 0.161 40 12.192 40 12.192 None 3003 3 Pinnacles Pinnacle 1 1.609 60 18.288 50 15.24 Mild 3004 3 Monastery Beach arine Life M 3 4.828 50 15.24 40 12.192 Surge
Skill Level Intermediate Intermediate Beginning Advanced Beginning Intermediate Beginning Advanced Beginning Intermediate Beginning Beginning Beginning Beginning
2006.09.14 - SLIDE 16
2006.09.14 - SLIDE 17
Shipwrecks = SHIPWRK
Ship Name Site No Delaware 7007 F.S.Loop 4004 Gosford 4001 Great Isaac 7002 Lizzie D 7001 Mohawk 7004 R.P. Resor 7006 Star of Scotland 4002 Tolten 7008 USS Moody 4006 Valiant 4003
Category Type Interest TonnageLength (ft) Length (m) Beam (ft) Beam (m) Commercial Steam Freighter Treasure 1646 252 76.8096 37 11.2776 Commercial Steam Schooner Machinery 794 193 58.8264 39 11.8872 Commercial Barque Rigged Sail Fixture 2250 280 85.344 42 12.8016 Commercial Seagoing Tug Fixture 1117 185 56.388 37 11.2776 Commercial Tug/Rumrunner Treasure 122 84 25.6032 21 6.4008 PassengerOcean Liner Treasure 8140 402 122.5296 54 16.4592 Commercial Tanker Treasure Oil 7450 435 132.588 66.8 20.36064 PassengerBritish Q-Boat Treasure 1250 263 80.1624 35 10.668 Commercial Freighter Fixture 1858 280 85.344 43 13.1064 Military WWI Destroyer Treasure 1308 314 95.7072 31 9.4488 PassengerLuxury Motor Yacht Treasure 444 162.4 49.49952 26 7.9248
Cause Date Sunk Comments Survivors Passengers/Crew Condition Graph Fire 66 66 Broken Deliberate 1/1/47 0 Scattered Fire Intact Collision 4/16/47 27 27 Intact Unknown 10/19/22 8 0 Intact Collision 1/25/35 163 118 Scattered Military 2/28/42 50 2 Broken Weather 1/22/42 5 4 Broken Military 3/13/42 28 1 Intact Deliberate 1/1/33 0 Intact Fire 12/17/30 25 25 Intact
2006.09.14 - SLIDE 19
Network
Need to pre-specify all of the links and sets
Object-Oriented
What are the objects, datatypes, their methods and the access points for them
Object-Relational
Same as relational, but what new datatypes might be needed or useful (more on OR later)
IS 257 Fall 2006 2006.09.14 - SLIDE 20
Lecture Outline
Review Logical Model for the Diveshop database Normalization Relational Advantages and Disadvantages
2006.09.14 - SLIDE 21
Normalization
Normalization theory is based on the observation that relations with certain properties are more effective in inserting, updating and deleting data than other sets of relations containing the same data Normalization is a multi-step process beginning with an unnormalized relation
Hospital example from Atre, S. Data Base: Structured Techniques for Design, Performance, and Management.
IS 257 Fall 2006 2006.09.14 - SLIDE 22
Normal Forms
First Normal Form (1NF) Second Normal Form (2NF) Third Normal Form (3NF) Boyce-Codd Normal Form (BCNF) Fourth Normal Form (4NF) Fifth Normal Form (5NF)
2006.09.14 - SLIDE 23
Normalization
Functional dependency of nonkey attributes on the primary key - Atomic values only Full Functional dependency of nonkey attributes on the primary key
2006.09.14 - SLIDE 24
Unnormalized Relations
First step in normalization is to convert the data into a two-dimensional table In unnormalized relations data can repeat within a column
2006.09.14 - SLIDE 25
Unnormalized Relation
Patient # Surgeon # Surg. date Patient Name Patient Addr Surgeon Surgery Postop drug Drug side effects Jan 1, 1995; June 12, 1995 John White 15 New St. New York, NY Gallstone s removal; Beth Little Kidney Michael stones Penicillin, Diamond removal none-
rash none
Mary Jones
2345 189
Jan 8, 1996
Charles Brown
4876 145
Hal Kane
5123 145
Paul Kosher
Charles Field 10 Main St. Patricia Rye, NY Gold Dogwood Lane Harrison, David NY Rosen 55 Boston Post Road, Chester, CN Beth Little Blind Brook Mamaronec k, NY Beth Little
Eye Cataract removal Thrombos Tetracyclin Fever is removal e none none Open Heart Surgery
6845 243
IS 257 Fall 2006
Ann Hood
Cholecyst ectomy Gallstone s Removal Eye Cornea Replacem ent Eye cataract removal
Demicillin
none
none
none
Tetracyclin e Fever
2006.09.14 - SLIDE 26
2006.09.14 - SLIDE 27
1111
145
Penicillin
rash
1111
311
none Tetracyclin e
none
1234
243
Charles Field
Fever
1234
467
Patricia Gold
none
2345
189
David Rosen
Cephalosp orin
none
4876
145
Beth Little
Cholecyst ectomy Demicillin Gallstone s Removal none Eye Cornea Replacem Tetracyclin ent e Eye cataract removal
none
5123
145
Blind Brook Mamaronec 10-May-95 Paul Kosher k, NY Beth Little Hilton Road Larchmont, NY Hilton Road Larchmont, NY
none
6845
243
Charles Field
Fever
6845
243
Charles Field
none
none
2006.09.14 - SLIDE 28
2006.09.14 - SLIDE 30
2006.09.14 - SLIDE 31
145 Beth Little 189 David Rosen 243 Charles Field 311 Michael Diamond 467 Patricia Gold
2006.09.14 - SLIDE 32
Tetracycline Fever
2006.09.14 - SLIDE 33
2006.09.14 - SLIDE 35
The side effect column in the Surgery table is determined by the drug administered
Side effect is transitively functionally dependent on drug so Surgery is not 3NF
2006.09.14 - SLIDE 36
Surgery
05-Apr-94 Eye Cataract removal Tetracycline 10-May-95 Thrombosis removal 08-Jan-96 Open Heart Surgery 05-Nov-95 Cholecystectomy 10-May-95 Gallstones Removal 15-Dec-84 Eye cataract removal Eye Cornea 05-Apr-94 Replacement none Cephalosporin Demicillin none none Tetracycline
2006.09.14 - SLIDE 37
2NF Storage Anomalies Removed Insertion: We can now enter the fact that a particular drug has a particular side effect in the Drug relation. Deletion: If John White recieves some other drug as a result of the rash from penicillin, but the information on penicillin and rash is maintained. Update: The side effects for each drug appear only once.
IS 257 Fall 2006 2006.09.14 - SLIDE 39
2006.09.14 - SLIDE 40
BCNF Relations
Patient # Patient Name 1111 John White 1234 Mary Jones Charles 2345 Brown 4876 Hal Kane 5123 Paul Kosher 6845 Ann Hood
IS 257 Fall 2006
Patient Address 15 New St. New York, NY 10 Main St. Rye, NY Dogwood Lane Harrison, NY 55 Boston Post Road, Chester, Blind Brook Mamaroneck, NY Hilton Road Larchmont, NY
2006.09.14 - SLIDE 42
2006.09.14 - SLIDE 43
2006.09.14 - SLIDE 44
Effectiveness and Efficiency Issues for DBMS Focus on the relational model Any column in a relational database can be searched for values. To improve efficiency indexes using storage structures such as BTrees and Hashing are used But many useful functions are not indexable and require complete scans of the the database
IS 257 Fall 2006 2006.09.14 - SLIDE 45
Text searching is still done best (and fastest) by specialized text search programs (Search Engines) that we will look at more later.
IS 257 Fall 2006 2006.09.14 - SLIDE 46
Normalization
Normalization is performed to reduce or eliminate Insertion, Deletion or Update anomalies. However, a completely normalized database may not be the most efficient or effective implementation. Denormalization is sometimes used to improve efficiency.
2006.09.14 - SLIDE 47
Normalizing to death
Normalization splits database information across multiple tables. To retrieve complete information from a normalized database, the JOIN operation must be used. JOIN tends to be expensive in terms of processing time, and very large joins are very expensive.
2006.09.14 - SLIDE 48
Downward Denormalization
Before:
Customer ID Address Name Telephone
After:
Order Order No Date Taken Date Dispatched Date Invoiced Cust ID Cust Name
2006.09.14 - SLIDE 49
Upward Denormalization
Order Order No Date Taken Date Dispatched Date Invoiced Cust ID Cust Name Order Item Order No Item No Item Price Num Ordered Order Order No Date Taken Date Dispatched Date Invoiced Cust ID Cust Name Order Price Order Item Order No Item No Item Price Num Ordered
2006.09.14 - SLIDE 50
Denormalization
Usually driven by the need to improve query speed Query speed is improved at the expense of more complex or problematic DML (Data manipulation language) for updates, deletions and insertions.
2006.09.14 - SLIDE 51
2006.09.14 - SLIDE 52
Cookie relationships
2006.09.14 - SLIDE 53
2006.09.14 - SLIDE 54
How to Normalize?
Currently no way to have multiple authors for a given book, and there is duplicate data spread over the BIBFILE table Can we use the DBMS to help us normalize? Access example
2006.09.14 - SLIDE 55
Need to watch the default values Helps to know what the primary key is, or if one is to be created automatically
Automatic creation is more complex in other RDBMS and ORDBMS
2006.09.14 - SLIDE 57
Lecture Outline
Review Logical Model for the Diveshop database Normalization Relational Advantages and Disadvantages
2006.09.14 - SLIDE 58
Advantages of RDBMS
Relational Database Management Systems (RDBMS) Possible to design complex data storage and retrieval systems with ease (and without conventional programming). Support for ACID transactions
Atomic Consistent Independent Durable
IS 257 Fall 2006 2006.09.14 - SLIDE 59
Advantages of RDBMS
Support for very large databases Automatic optimization of searching (when possible) RDBMS have a simple view of the database that conforms to much of the data used in business Standard query language (SQL)
2006.09.14 - SLIDE 60
Disadvantages of RDBMS
Until recently, no real support for complex objects such as documents, video, images, spatial or time-series data. (ORDBMS add -- or make available support for these) Often poor support for storage of complex objects from OOP languages (Disassembling the car to park it in the garage) Usually no efficient and effective integrated support for things like text searching within fields (MySQL does have simple keyword searching now with index support)
IS 257 Fall 2006 2006.09.14 - SLIDE 61
Next Week
Database Design Workshop
2006.09.14 - SLIDE 62