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 11 1 1Louis Jazdzewski 1 1 O'Connor Orleans 11 New LA 111 11 11 1 1Barbara Wright1W. Freeway 11 1 San Francisco CA 111 11 11 1 1Stephen Bredenburg 5 5Place IN 5 5N.E. 5 5 Indianapolis 111 11 11 1 1Phillip Davoust First Street 11 1 Berkeley CA 111 11 11 1 1David Burgett 1Montgomery Street 1 1 Seattle WA 111 11 11 1 1Mary Rioux1 1 Gateway Blvd. #1 1 11 Pueblo CO 1 111 11 11 1 1Kim Lopez 1 1 1Nottingham Lane 11 Honolulu HI 111 11 11 1 1Hiram Marley 1 Mill Run Drive CA 1 1 1 San Francisco 111 11 11 1 1Tanya Kulesa1S. Flower, Mail Stop 1 1 1 1 1 1 1 1 New York NY 1 1 1 1 11 1 1Charles Sekaron 1 1East Park Avenue, Box 1 1 1 1 1 Miller SD 11 11 1 1Lowell Lutz1 1E. Fesler 1 Dallas TX 111 11 11 1 1Keith Lucas 1South Euclid 1 Chicago IL 111 11 11 1 1Karen Ng 1 1 Elmhill Pike Falls 11 Klamath OR 111 11 11 1 1Ken Soule 1 Sansome Street CO 1 Aurora 111 11 Code Country U.S.A. U.S.A. U.S.A. U.S.A. U.S.A. U.S.A. U.S.A. U.S.A. U.S.A. U.S.A. U.S.A. U.S.A. U.S.A. U.S.A. Phone First Contact (111 -1111 1 ) 111 11 / / 11 (111 -1111 1 ) 111 111 / / (111 -1111 1 ) 111 111 / / (111 -1111 1 ) 111 111 / / (111 -1111 1 ) 111 11 / / 11 (111 -1111 1 ) 111 11 / / 11 (111 -1111 1 ) 111 11 / / 11 (111 -1111 1 ) 111 11 / / 11 (111 -1111 1 ) 111 11 / / 11 (111 -1111 1 ) 111 11 / / 11 (111 -1111 1 ) 111 11 / / 11 (111 -1111 1 ) 111 11 / / 11 (111 -1111 1 ) 111 11 / / 11 (111 -1111 1 ) 111 111 / /
2006.09.14 - SLIDE 10
2006.09.14 - SLIDE 11
Line Note 1 1This is our most popular mask. 1 1These are our best selling fins. 1 1 1 1A good weight belt for beginners 1 1 1Holds 11 cubic feet of cargo. 1 1 1 1
2006.09.14 - SLIDE 12
Ship Cost 1 1 1 5 5 5 5 1
2006.09.14 - SLIDE 13
2006.09.14 - SLIDE 14
Destination No Destination Name Avg Temp Avg Temp Spring Temp (F) Temp (C) Temp (F) TempTemp (F) Temp Winter Temp (F) Temp (C) (F) (C) Spring Summer Summer Fall (C) Fall (C) Winter Accomodations Life Night 1Cozumel 1 1 1 .1 1 11 1 1 5 .5 5 55 1 1 5 .5 5 55 1 1 1 .1 1 11 1 1 5 .5 5Cheap 55 Sleepy 1Great Barrier Reef1 1 1 .1 1 11 1 1 1 .1 1 11 1 1 1 .1 1 11 1 1 1 .1 1 11 1 1 1 .1 1Moderate Pleasant 11 1Monterey 1 1 1 .1 1 11 1 1 1 .1 1 11 1 1 1 .1 1 11 1 1 1 .1 1 11 1 1 1 .1 1ExpensiveWild 11 1Santa Barbara 1 1 1 .1 1 11 1 1 1 .1 1 11 1 1 1 .1 1 11 1 1 1 .1 1 11 1 1 1 .1 1ExpensiveWild 11 1Florida 1 1 1 1 1 1 1 .1 1 11 1 1 1 .1 1 11 1 1 1 .1 1 11 1 1 1 .1 1Moderate Pleasant 11 1Fiji 1 1 1 .1 1 11 1 1 1 .1 1 11 1 1 1 .1 1 11 1 1 1 .1 1 11 1 1 1 .1 1ExpensiveSleepy 11 1New J ersey 1 1 1 .1 1 11 1 1 1 .1 11 1 1 1 .1 1 11 1 1 1 .1 1 11 1 1 1 .1 1ExpensivePleasant 11
Body of Water Cost Travel Caribbean 55 55 Coral Sea 11 11 Pacific 11 11 Pacific 11 11 Caribbean 11 11 South Pacific 1 1 11 Atlantic 11 11
2006.09.14 - SLIDE 15
Site No Destination Site Nam No e Site Highlight Site NotesDistance fromTown (km(m Visibility (ft Visibility (mCurrent Distance from Town h (ft)Depth ) ) Dept(m ) ) ) 11 11 1Palancar Reef Reef 1 5. 5 1 5 5 11 1 1. 1 1 1 55 5 5 . 5Strong 5 5 11 11 1Santa Rosa Reef Reef 1 1. 1 1 1 1 1 1 .11 11 11 1 1 . 1Strong 1 1 11 11 1Chancanab Reef Reef 1 11 .11 1 1 1 .11 11 11 1 1 . 1Mild 1 1 11 11 1Punta Sur Reef 1 1. 1 1 1 1 11 1 1 .11 11 11 1 1 . 1Strong 1 1 11 11 1Yocab Reef Reef 1 11 .11 1 1 1. 1 1 1 11 1 1 . 1Mild 1 1 11 11 1Heron Island Reef 1 1. 1 1 1 1 1 1 1 .11 11 11 1 1 . 1Mild 1 1 11 11 1Cod Hole Fish 1 1. 1 1 1 1 1 1 1. 1 1 1 11 1 1 . 1Mild 1 1 11 11 1Butterfly Bay Caves 1 1. 1 1 1 1 1 1 1 .11 11 1 1 1 . 1 None 1 1 1 11 11 1Wheeler Reef Marine Life 1 1. 1 1 1 1 1 1 1. 1 1 1 11 1 1. 1 1Mild 11 11 1Watanabe Marine Life 11 11 1 1. 1 11 1 1. 1 1 1 11 1 1 . 1None 1 1 11 11 1Point Lobos Marine Life 1 11 .11 1 1 1 .11 11 1 1 1 . 1None 1 1 11 11 1Macabee Beach Marine Life 1 .1 1 1 .11 1 1 1 .11 11 1 1 1 . 1 None 1 1 1 11 11 1Pinnacles Pinnacle 1 11 .11 1 1 1 .11 11 1 1 1 . 1Mild 1 1 11 11 1Monastery BeachMarine Life 1 11 .11 1 1 1. 1 1 1 1 1 1 . 1 Surge 1 1 1
Skill Level Interm ediate Interm ediate Beginning Advanced Beginning Interm ediate Beginning Advanced Beginning Interm ediate Beginning Beginning Beginning Beginning
2006.09.14 - SLIDE 16
2006.09.14 - SLIDE 17
No 11 11 11 11 55 55 55 55 55 55 11 11 11 11 11 11 11 11 11 11 11 11
2006.09.14 - SLIDE 18
Shipwrecks = SHIPWRK
Ship Nam e Sit No Cat e egory Type Int erest Tonnage Lengt (ft h Lengt (m Beam(ft ) h ) Beam(m Cause ) ) Dat Sunk Com ent Survivors ondition e m s Passengers/Crew C Delaw are 11 Com ercialSt 11 m eamFreight Treasure er 11 11 11 5 . 55 1 5 5 5 1 1 1 . 11 Fire 1 1 1 1 1 1 1Broken F.S.Loop 11 Com ercialSt 11 m eamSchooner Machinery 11 1 11 1 . 11 1 1 1 1 1 1 1 . 11 Deliberat 1 1 1 e 1 /1 /1 1 1 Scatered t Gosford 11 Com ercialBarque Riggedure 11 m Fix Sail t 11 11 11 1 1. 1 1 1 1 1 1 1 . 11 Fire 1 1 1 Int act GreatIsaac 11 Com ercialSeagoing Tug t 11 m Fixure 11 11 11 1 1. 1 1 1 1 1 1 1 . 11 Collision 1 1 1 111 /1/1 1 1 1 1Int act Lizzie D 11 Com ercialTug/Rum Treasure 11 m runner 11 1 1 1 1 . 11 1 1 1 1 1 1 11 Unknow .11 n 1/ 1 1 1 / 11 1 1Int act Mohaw k 11 Passenger Ocean LinerTreasure 11 11 11 11 11 11 1 1. 1 1 1 1 1 . 11 Collision 1 1 1 111 /1/1 11 1 11Scatered 1 t R.P. Resor 11 Com ercialOil Tanker Treasure 11 m 11 11 11 11 1 1 1 . 1 1. 1 1 1 . 11 Milit 1 1 11 1 ary 111 /1/1 1 1 1Broken St of Scot ar land 11 Passenger Brit Q-Boat 11 ish Treasure 11 11 11 1 . 11 1 1 1 1 1 1 1 . 1 Weat 1 1 1 her 111 /1/1 1 1Broken Tolt en 11 Com ercialFreight 11 m er Fixure t 11 11 11 1 1. 1 1 1 1 1 1 1 . 11 Milit 1 1 1 ary 111 /1/1 1 1 1Int act USS Moody 11 Milit 11 ary WWI Dest Treasure royer 11 11 11 1 . 11 1 1 1 1 1 1 1 11 Deliberat .11 e 1 /1 /1 1 1 Int act Valiant 11 Passenger Luxury Mot Treasure 11 or Yacht 11 11 1 1. 1 1 . 11 1 11 1 1 1 1 11 Fire .11 1/ 1 1 1 / 11 1 1 1 1Int act
Graphi
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
No transitive dependency between nonkey attributes All determinants are candidate keys - Single multivalued dependency
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 Gallstone s remov al; Kidney stones remov al Eye C ataract remov al T hrombos is remov al Open H eart Surgery Postop drug rug side effects D Jan 1 , 55 ; June 55 5 , 55 555 1 N St. 1 ew N York, ew N Y Beth Little Michael Diamond
55 5 11 11 11 1
John White
Penicillin, none-
rash none
11 1 11 55 11 5
Mary Jones
11 55 11 5
Jan 1 , 11 11
Charles Brow n
11 11 11 1
Nov 1 , 11 11 May 1 ,1 11 11
Hal Kane
11 11 11 1
Paul Kosher
1 Main St. 1 R ye, N Y D ogwood Lane H arrison, N Y 1 Boston 1 Post R oad, C hester, C N Blind Brook Mamaronec k, N Y
T etracyclin e none
Fev er none
Dav id Rosen
C ephalosp orin
none
Beth Little
Beth Little
11 11 11 1
IS 257 Fall 2006
Apr 1 , 11 D 11 ec 1 , 11 111
Ann H ood
Charles Field
C holecyst ectomy Gallstone s R emov al Eye C ornea R eplacem ent Eye cataract remov al
D emicillin
none
none
none
T etracyclin e
Fev er
2006.09.14 - SLIDE 26
2006.09.14 - SLIDE 27
J h Wite on h
B thL e ittle M he ic a l D mn ia o d
P n illin e ic
rs ah
11 1 1
1 1 1
5- u5J n 5 5
J h Wite on h
nn oe T tr c c e a y lin e
nn oe
11 1 1
1 1 1
1 - p1A 1 r1
Mr J n s ay o e
C ale F ld h r s ie
F vr ee
11 1 1
5 5 5
1- a1My1 1
Mr J n s ay o e
P tr iaGld a ic o
nn oe
nn oe
11 1 1
5 5 5
1- a1J n 1 1
C ale hr s Bo n rw
D v Rs n aid o e
Cp a s e h lo p oin r
nn oe
11 1 1
1 1 1
1 - o1N1 v 1
Hl K n a ae
B thL e ittle
Co c s h le y t e to y c m Glls n a to e s R mv l e oa Ee y Cr e on a Rp c m e la e et n Ee y c taa t a rc r mv l e oa
Dm illin e ic
nn oe
11 1 1
1 1 1
1- a1My1 1
PuKs e al ohr
B thL e ittle
nn oe
nn oe
11 1 1
1 1 1
1 - p1A 1 r1
A nH o n od
C ale F ld h r s ie
T tr c c e a y lin e
F vr ee
11 1 1
1 1 1
1- e1D c1 1
A nH o n od
C ale F ld h r s ie
nn oe
nn oe
2006.09.14 - SLIDE 28
2006.09.14 - SLIDE 30
2006.09.14 - SLIDE 31
1 1Beth Little 1 5 5David Rosen 5 1 1Charles Field 1 1 1Michael Diamond 1 5 5Patricia Gold 5
2006.09.14 - SLIDE 32
2006.09.14 - SLIDE 33
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
Drug Admin Penicillin none Tetracycline none Cephalosporin Demicillin none none Tetracycline
2006.09.14 - SLIDE 37
55 5 11 1 11 1 55 5 55 5 11 1 11 1 11 1 11 1
1 -Jan-1 Gallstones removal 1 1 Kidney stones 5 -Jun-5 removal 5 5 1 -Apr-1 Eye Cataract removal 1 1 1 -May-1 Thrombosis removal 1 1 1 -Jan-1 Open Heart Surgery 1 1 1 -Nov-1 Cholecystectomy 1 1 1 -May-1 Gallstones Removal 1 1 1 -Dec-1 Eye cataract removal 1 1 Eye Cornea 1 -Apr-1 Replacement 1 1
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 P atient # P atient A ddres s 5 New S t. New 5 1 1 Y ork, NY 11 5 M ain S t. Ry e, 5 5 5 NY 55 Dogwood Lane 1 1 Harris on, NY 11 1 B os ton Post 1 5 5 Road, Ches ter, 55 B lind B rook 1 1 M am aronec k, NY 11 Hilton Road 1 1 Larc hm ont, NY 11
2006.09.14 - SLIDE 42
11 1 1John White 55 5 5Mary Jones Charles 5 5 Brown 55 55 5 5Hal Kane 11 1 1Paul Kosher 11 1 1Ann Hood
IS 257 Fall 2006
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