- 330.00 KB
- 2022-04-29 14:33:34 发布
- 1、本文档共5页,可阅读全部内容。
- 2、本文档内容版权归属内容提供方,所产生的收益全部归内容提供方所有。如果您对本文有版权争议,可选择认领,认领后既往收益都归您。
- 3、本文档由用户上传,本站不保证质量和数量令人满意,可能有诸多瑕疵,付费之前,请仔细先通过免费阅读内容等途径辨别内容交易风险。如存在严重挂羊头卖狗肉之情形,可联系本站下载客服投诉处理。
- 文档侵权举报电话:19940600175。
'AppendixB:AdvancedRelationalDatabaseDesign
AppendixB:AdvancedRelationalDatabaseDesignReasoningwithMVDsHighernormalformsJoindependenciesandPJNFDKNF
TheoryofMultivaluedDependenciesLetDdenoteasetoffunctionalandmultivalueddependencies.TheclosureD+ofDisthesetofallfunctionalandmultivalueddependencieslogicallyimpliedbyD.Soundandcompleteinferencerulesforfunctionalandmultivalueddependencies:1.Reflexivityrule.Ifisasetofattributesand,thenholds.2.Augmentationrule.Ifholdsandisasetofattributes,thenholds.3.Transitivityrule.Ifholdsandholds,thenholds.
TheoryofMultivaluedDependencies(Cont.)4.Complementationrule.Ifholds,thenR––holds.5.Multivaluedaugmentationrule.IfholdsandRand,thenholds.6.Multivaluedtransitivityrule.Ifholdsandholds,then–holds.7.Replicationrule.Ifholds,then.8.Coalescencerule.IfholdsandandthereisasuchthatRand=and,thenholds.
SimplificationoftheComputationofD+WecansimplifythecomputationoftheclosureofDbyusingthefollowingrules(provedusingrules1-8).Multivaluedunionrule.Ifholdsandholds,thenholds.Intersectionrule.Ifholdsandholds,thenholds.Differencerule.IfIfholdsandholds,then–holdsand–holds.
ExampleR=(A,B,C,G,H,I)D={ABBHICGH}SomemembersofD+:ACGHI.SinceAB,thecomplementationrule(4)impliesthatAR–B–A.SinceR–B–A=CGHI,soACGHI.AHI.SinceABandBHI,themultivaluedtransitivityrule(6)impliesthatBHI–B.SinceHI–B=HI,AHI.
Example(Cont.)SomemembersofD+(cont.):BH.Applythecoalescencerule(8);BHIholds.SinceHHIandCGHandCGHI=Ø,thecoalescenceruleissatisfiedwithbeingB,beingHI,beingCG,andbeingH.WeconcludethatBH.ACG.ACGHIandAHI.Bythedifferencerule,ACGHI–HI.SinceCGHI–HI=CG,ACG.
NormalizationUsingJoinDependenciesJoindependenciesconstrainthesetoflegalrelationsoveraschemaRtothoserelationsforwhichagivendecompositionisalossless-joindecomposition.LetRbearelationschemaandR1,R2,...,RnbeadecompositionofR.IfR=R1R2….Rn,wesaythatarelationr(R)satisfiesthejoindependency*(R1,R2,...,Rn)if:r=R1(r)⋈R2(r)⋈……⋈Rn(r)AjoindependencyistrivialifoneoftheRiisRitself.Ajoindependency*(R1,R2)isequivalenttothemultivalueddependencyR1R2R2.Conversely,isequivalentto*((R-),)However,therearejoindependenciesthatarenotequivalenttoanymultivalueddependency.
Project-JoinNormalForm(PJNF)ArelationschemaRisinPJNFwithrespecttoasetDoffunctional,multivalued,andjoindependenciesifforalljoindependenciesinD+oftheform*(R1,R2,...,Rn)whereeachRiRandR=R1R2...Rnatleastoneofthefollowingholds:*(R1,R2,...,Rn)isatrivialjoindependency.EveryRiisasuperkeyforR.Sinceeverymultivalueddependencyisalsoajoindependency,everyPJNFschemaisalsoin4NF.
ExampleConsiderLoan-info-schema=(branch-name,customer-name,loan-number,amount).Eachloanhasoneormorecustomers,isinoneormorebranchesandhasaloanamount;theserelationshipsareindependent,hencewehavethejoindependency*(=(loan-number,branch-name),(loan-number,customer-name),(loan-number,amount))Loan-info-schemaisnotinPJNFwithrespecttothesetofdependenciescontainingtheabovejoindependency.ToputLoan-info-schemaintoPJNF,wemustdecomposeitintothethreeschemasspecifiedbythejoindependency:(loan-number,branch-name)(loan-number,customer-name)(loan-number,amount)
Domain-KeyNormalForm(DKNY)Domaindeclaration.LetAbeanattribute,andletdombeasetofvalues.ThedomaindeclarationAdomrequiresthattheAvalueofalltuplesbevaluesindom.Keydeclaration.LetRbearelationschemawithKR.Thekeydeclarationkey(K)requiresthatKbeasuperkeyforschemaR(KR).Allkeydeclarationsarefunctionaldependenciesbutnotallfunctionaldependenciesarekeydeclarations.Generalconstraint.Ageneralconstraintisapredicateonthesetofallrelationsonagivenschema.LetDbeasetofdomainconstraintsandletKbeasetofkeyconstraintsforarelationschemaR.LetGdenotethegeneralconstraintsforR.SchemaRisinDKNFifDKlogicallyimplyG.
ExampleAccountswhoseaccount-numberbeginswiththedigit9arespecialhigh-interestaccountswithaminimumbalanceof2500.Generalconstraint:``Ifthefirstdigitoft[account-number]is9,thent[balance]2500.""DKNFdesign:Regular-acct-schema=(branch-name,account-number,balance)Special-acct-schema=(branch-name,account-number,balance)Domainconstraintsfor{Special-acct-schema}requirethatforeachaccount:Theaccountnumberbeginswith9.Thebalanceisgreaterthan2500.
DKNFrephrasingofPJNFDefinitionLetR=(A1,A2,...,An)bearelationschema.Letdom(Ai)denotethedomainofattributeAi,andletallthesedomainsbeinfinite.ThenalldomainconstraintsDareoftheformAidom(Ai).LetthegeneralconstraintsbeasetGoffunctional,multivalued,orjoindependencies.IfFisthesetoffunctionaldependenciesinG,letthesetKofkeyconstraintsbethosenontrivialfunctionaldependenciesinF+oftheformR.SchemaRisinPJNFifandonlyifitisinDKNFwithrespecttoD,K,andG.
EndofAppendixB
FigureB.01
FigureB.02
FigureB.03
FigureB.04
FigureB.05
FigureB.06
FigureB.07'
您可能关注的文档
- 施工企业会计第二版辛艳红配套教学课件PPT 第10章 工程成本和期间费用.ppt
- 施工企业会计第二版辛艳红配套教学课件PPT 第1章_总论.ppt
- 数据结构课件PPT110章全 第四章 串.ppt
- 数据结构课件PPT110章全 第五章 数组和广义表.ppt
- 数据结构课件PPT110章全 第六章 树和二叉树.ppt
- 数据结构课件PPT110章全 第七章 图.ppt
- 数据库系统概念全套配套课件PPT ch12.ppt
- 数据库系统概念全套配套课件PPT ch6.ppt
- 数据库系统概念全套配套课件PPT ch2.ppt
- 数据库系统概念全套配套课件PPT ch16.ppt
- 数据库系统概念全套配套课件PPT ch7.ppt
- 数据库系统概念全套配套课件PPT ch26.ppt
- 数据库系统概念全套配套课件PPT ch22.ppt
- 数据库系统概念全套配套课件PPT ch23.ppt
- 数据库系统概念全套配套课件PPT ch21.ppt
- 数据库系统概念全套配套课件PPT ch15.ppt
- 土木工程材料第2版柯国军配套教学课件PPT 06土木工程材料.ppt
- 土木工程材料第2版柯国军配套教学课件PPT 01土木工程材料.ppt