db - er - 180312 · 434 announcements! • keep bringing your name plates j • verify your grades...
TRANSCRIPT
![Page 1: DB - ER - 180312 · 434 Announcements! • Keep bringing your name plates J • Verify your grades and feedback on BB. If something is unclear or confusing, or displays incorrectly,](https://reader033.vdocuments.mx/reader033/viewer/2022042100/5e7bdd25676e4851985a715e/html5/thumbnails/1.jpg)
433
L15:Normalization
CS3200 Databasedesign(sp18 s2)https://course.ccs.neu.edu/cs3200sp18s2/3/12/2018
![Page 2: DB - ER - 180312 · 434 Announcements! • Keep bringing your name plates J • Verify your grades and feedback on BB. If something is unclear or confusing, or displays incorrectly,](https://reader033.vdocuments.mx/reader033/viewer/2022042100/5e7bdd25676e4851985a715e/html5/thumbnails/2.jpg)
434
Announcements!
• KeepbringingyournameplatesJ• VerifyyourgradesandfeedbackonBB.Ifsomethingisunclearorconfusing,ordisplaysincorrectly,pleaseletusknow(e.g.,viaPiazzainstructorsonly)
• P2 ispostedandupdatedcalendar• Exam2 nextweek:contentiseverythingseenuntilthisThursday:setuplikeforExam1:laptopSQL+paperdatabasedesign+papertransactions
• Outlinetoday- HW4,Projects- Decompositions- Transactions!
![Page 3: DB - ER - 180312 · 434 Announcements! • Keep bringing your name plates J • Verify your grades and feedback on BB. If something is unclear or confusing, or displays incorrectly,](https://reader033.vdocuments.mx/reader033/viewer/2022042100/5e7bdd25676e4851985a715e/html5/thumbnails/3.jpg)
435
![Page 4: DB - ER - 180312 · 434 Announcements! • Keep bringing your name plates J • Verify your grades and feedback on BB. If something is unclear or confusing, or displays incorrectly,](https://reader033.vdocuments.mx/reader033/viewer/2022042100/5e7bdd25676e4851985a715e/html5/thumbnails/4.jpg)
436
Ryan'squestion:ParkingTickets:ERDiagram
STID LName FName PhoneNo StLic LicNo
Code Fine
Ticketnr Date Code@ STID@
Student
TicketCode
Ticket
Violation
![Page 5: DB - ER - 180312 · 434 Announcements! • Keep bringing your name plates J • Verify your grades and feedback on BB. If something is unclear or confusing, or displays incorrectly,](https://reader033.vdocuments.mx/reader033/viewer/2022042100/5e7bdd25676e4851985a715e/html5/thumbnails/5.jpg)
437
Ryan'squestion:ParkingTickets:ERDiagram
![Page 6: DB - ER - 180312 · 434 Announcements! • Keep bringing your name plates J • Verify your grades and feedback on BB. If something is unclear or confusing, or displays incorrectly,](https://reader033.vdocuments.mx/reader033/viewer/2022042100/5e7bdd25676e4851985a715e/html5/thumbnails/6.jpg)
438
Decompositions
![Page 7: DB - ER - 180312 · 434 Announcements! • Keep bringing your name plates J • Verify your grades and feedback on BB. If something is unclear or confusing, or displays incorrectly,](https://reader033.vdocuments.mx/reader033/viewer/2022042100/5e7bdd25676e4851985a715e/html5/thumbnails/7.jpg)
439
Recap:Decomposetoremoveredundancies
• Wesawthatredundanciesinthedata(“badFDs”)canleadtodataanomalies
• Wedevelopedmechanismstodetectandremoveredundanciesbydecomposingtablesinto3NF orBCNF- BCNF decompositionisstandardpractice- verypowerful&widelyused!
• However,sometimesdecompositionscanleadtomoresubtleunwantedeffects…
Whendoesthishappen?
![Page 8: DB - ER - 180312 · 434 Announcements! • Keep bringing your name plates J • Verify your grades and feedback on BB. If something is unclear or confusing, or displays incorrectly,](https://reader033.vdocuments.mx/reader033/viewer/2022042100/5e7bdd25676e4851985a715e/html5/thumbnails/8.jpg)
440
DecompositionsinGeneral
R1 =theprojection ofRonA1,...,An,B1,...,Bm
R(A1,...,An,B1,...,Bm,C1,...,Cp)
R1(A1,...,An,B1,...,Bm) R2(A1,...,An,C1,...,Cp)
R2 =theprojection ofRonA1,...,An,C1,...,Cp
![Page 9: DB - ER - 180312 · 434 Announcements! • Keep bringing your name plates J • Verify your grades and feedback on BB. If something is unclear or confusing, or displays incorrectly,](https://reader033.vdocuments.mx/reader033/viewer/2022042100/5e7bdd25676e4851985a715e/html5/thumbnails/9.jpg)
441
TheoryofDecomposition
Name Price CategoryGizmo 19.99 Gadget
OneClick 24.99 CameraGizmo 19.99 Camera
Name PriceGizmo 19.99
OneClick 24.99Gizmo 19.99
Name CategoryGizmo Gadget
OneClick CameraGizmo Camera
I.e.itisaLosslessdecomposition
Sometimesadecompositionis“correct”
![Page 10: DB - ER - 180312 · 434 Announcements! • Keep bringing your name plates J • Verify your grades and feedback on BB. If something is unclear or confusing, or displays incorrectly,](https://reader033.vdocuments.mx/reader033/viewer/2022042100/5e7bdd25676e4851985a715e/html5/thumbnails/10.jpg)
442
LossyDecomposition
Name CategoryGizmo Gadget
OneClick CameraGizmo Camera
Price Category19.99 Gadget24.99 Camera19.99 Camera
What’swronghere?
Howeversometimesitisn’tName Price Category
Gizmo 19.99 GadgetOneClick 24.99 Camera
Gizmo 19.99 Camera
![Page 11: DB - ER - 180312 · 434 Announcements! • Keep bringing your name plates J • Verify your grades and feedback on BB. If something is unclear or confusing, or displays incorrectly,](https://reader033.vdocuments.mx/reader033/viewer/2022042100/5e7bdd25676e4851985a715e/html5/thumbnails/11.jpg)
443
LosslessDecompositions
AdecompositionRto(R1,R2)islossless ifR=R1JoinR2
R(A1,...,An,B1,...,Bm,C1,...,Cp)
R1(A1,...,An,B1,...,Bm) R2(A1,...,An,C1,...,Cp)
![Page 12: DB - ER - 180312 · 434 Announcements! • Keep bringing your name plates J • Verify your grades and feedback on BB. If something is unclear or confusing, or displays incorrectly,](https://reader033.vdocuments.mx/reader033/viewer/2022042100/5e7bdd25676e4851985a715e/html5/thumbnails/12.jpg)
444
LosslessDecompositions
BCNFdecompositionisalwayslossless.Why?
Note:don’tneed{A1,...,An}à {C1,...,Cp}
If {A1,...,An}à {B1,...,Bm}Thenthedecompositionislossless
R(A1,...,An,B1,...,Bm,C1,...,Cp)
R1(A1,...,An,B1,...,Bm) R2(A1,...,An,C1,...,Cp)
![Page 13: DB - ER - 180312 · 434 Announcements! • Keep bringing your name plates J • Verify your grades and feedback on BB. If something is unclear or confusing, or displays incorrectly,](https://reader033.vdocuments.mx/reader033/viewer/2022042100/5e7bdd25676e4851985a715e/html5/thumbnails/13.jpg)
445
AproblemwithBCNF
Note:Thisishistoricallyinaccurate,butitmakesiteasiertoexplain
Problem:ToenforceaFD,mustreconstructoriginalrelation—oneachinsert!
![Page 14: DB - ER - 180312 · 434 Announcements! • Keep bringing your name plates J • Verify your grades and feedback on BB. If something is unclear or confusing, or displays incorrectly,](https://reader033.vdocuments.mx/reader033/viewer/2022042100/5e7bdd25676e4851985a715e/html5/thumbnails/14.jpg)
446
AProblemwithBCNF{Unit} à {Company}{Company,Product} à {Unit}
WedoaBCNFdecompositionona“bad”FD:{Unit}+ = {Unit, Company}
WelosetheFD{Company,Product} à {Unit}!!
Unit Company Product… … …
Unit Company… …
Unit Product… …
{Unit} à {Company}
![Page 15: DB - ER - 180312 · 434 Announcements! • Keep bringing your name plates J • Verify your grades and feedback on BB. If something is unclear or confusing, or displays incorrectly,](https://reader033.vdocuments.mx/reader033/viewer/2022042100/5e7bdd25676e4851985a715e/html5/thumbnails/15.jpg)
447
SoWhyisthataProblem?
Noproblemsofar.Alllocal FD’saresatisfied.
Unit CompanyGalaga99 NEUBingo NEU
Unit ProductGalaga99 DatabasesBingo Databases
Unit Company ProductGalaga99 NEU DatabasesBingo NEU Databases
Let’sputallthedatabackintoasingletableagain:
{Unit} à {Company}
ViolatestheFD{Company,Product} à {Unit}!!
{Unit} à {Company}{Company,Product} à {Unit}
![Page 16: DB - ER - 180312 · 434 Announcements! • Keep bringing your name plates J • Verify your grades and feedback on BB. If something is unclear or confusing, or displays incorrectly,](https://reader033.vdocuments.mx/reader033/viewer/2022042100/5e7bdd25676e4851985a715e/html5/thumbnails/16.jpg)
448
TheProblem
• WestartedwithatableRandFDsF
• WedecomposedRintoBCNFtablesR1,R2,…withtheirownFDsF1,F2,…
• Weinsertsometuplesintoeachoftherelations—whichsatisfytheirlocalFDsbutwhenreconstructitviolatessomeFDacrosstables!
PracticalProblem:ToenforceFD,mustreconstructR—oneachinsert!
![Page 17: DB - ER - 180312 · 434 Announcements! • Keep bringing your name plates J • Verify your grades and feedback on BB. If something is unclear or confusing, or displays incorrectly,](https://reader033.vdocuments.mx/reader033/viewer/2022042100/5e7bdd25676e4851985a715e/html5/thumbnails/17.jpg)
449
PossibleSolutions
• Variouswaystohandlesothatdecompositionsarealllossless/noFDslost- Forexample3NF: stopshortoffullBCNF decompositions.
• Usuallyatradeoffbetweenredundancy/dataanomaliesandFDpreservation…
BCNFstillmostcommon- withadditionalstepstokeeptrackoflostFDs…
![Page 18: DB - ER - 180312 · 434 Announcements! • Keep bringing your name plates J • Verify your grades and feedback on BB. If something is unclear or confusing, or displays incorrectly,](https://reader033.vdocuments.mx/reader033/viewer/2022042100/5e7bdd25676e4851985a715e/html5/thumbnails/18.jpg)
450
4NF and higher
![Page 19: DB - ER - 180312 · 434 Announcements! • Keep bringing your name plates J • Verify your grades and feedback on BB. If something is unclear or confusing, or displays incorrectly,](https://reader033.vdocuments.mx/reader033/viewer/2022042100/5e7bdd25676e4851985a715e/html5/thumbnails/19.jpg)
451
3NFMotivation
ArelationRisin3rdnormalformif:Wheneverthereisanontrivialdep.A1,A2,...,An® BforR,then{A1,A2,...,An }isasuper-keyforR,orBispartofakey.
Tradeoffs:BCNF:noanomalies,butmaylosesomeFDs3NF:keepsallFDs,butmayhavesomeanomalies
![Page 20: DB - ER - 180312 · 434 Announcements! • Keep bringing your name plates J • Verify your grades and feedback on BB. If something is unclear or confusing, or displays incorrectly,](https://reader033.vdocuments.mx/reader033/viewer/2022042100/5e7bdd25676e4851985a715e/html5/thumbnails/20.jpg)
452
Motivationof4NFandhigher
Course Lecturer Book
cse444 Alexandra Completebook
cse444 Wolfgang Completebook
cse444 Alexandra Cowbook
Assumeforeachcourse,wecanindependentlychoosealecturerandabook.Whatistheproblem?
Multi-valueddependency(MVD)Course®® Lecturer:Ineverylegalinstance,eachCourse valueisassociatedwithasetofLecturer valuesandthissetisindependentofthevaluesintheotherattributes(hereBook).
Classes
cse444 Wolfgang Cowbook