资源描述:
《数据库系统英第三版课件衷宜2011版 NF(3).ppt》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、Chapter3DesignTheoryforRelationalDatabases第3章关系数据库设计原则3DesignTheoryforRelationalDatabaseFunctionalDependencies函数依赖Normalforms范式Howtoassurecertainformconditionbydecomposingrelationalmodel?3.1.1DefinitionofFunctionalDependencyX->AisanassertionaboutarelationRthatwhenevertw
2、otuplesofRagreeonalltheattributesofX,thentheymustalsoagreeontheattributeA.Say“X->AholdsinR.”Say“XfunctionallydetermineA.”Iftanduagreehere,tuXAThentheymustagreehereX函数决定A3.1.1DefinitionofFunctionalDependencyCorollary1A1A2…An→B1A1A2…An→B2…A1A2…An→BmiffA1A2…An→B1B2…BmCorol
3、lary2A→A3.1.1DefinitionofFunctionalDependencyThreecasesofassertingfunctionaldependenciesIfanytwotupleswiththesamevaluesintheirAcomponentsalsohavethesamevaluesinB,thenA→Bholds.ABCDa1b1c1d1a1b2c1d2a2b2c2d2a2b3c2d3a3b3c2d4A->C?3.1.1DefinitionofFunctionalDependencyThreecase
4、sofassertingfunctionaldependencies(Cont.)IftherearetwotupleswiththesamevaluesintheirAcomponentsdonothavethesamevaluesinB,thenA→Bdoesnothold.ABCDa1b1c1d1a1b2c1d2a2b2c2d2a2b3c2d3a3b3c2d4C->A?BC->D?3.1.1DefinitionofFunctionalDependencyThreecasesofassertingfunctionaldepende
5、ncies(Cont.)Ifanytwotupleshaven’tthesamevaluesintheirAcomponents,thenA→Bholds.ABCDa1b1c1d1a1b2c1d2a2b2c2d3a2b3c2d4a3b3c2d5D->A?D->B?D->C?3.1.1DefinitionofFunctionalDependencyExample:WhichfunctionaldependenciesexistintherelationMovies(title,year,length,filmtype,studioNam
6、e,starName)?titleyear→lengthfilmTypestudioName?titleyear→starName?title→yearlengthfilmTypestudioName?titleyearlengthfilmTypestudioNamestarNameStarWarsStarWarsStarWarsMightyDucksWayne’sWorldWayne’sWorld…1977197719771991199219921241241241049595colorcolorcolorcolorcolorcol
7、orFoxFoxFoxDisneyParamountParamountCarrieFisherMarkHamillHarrisonFordEmilioEstevezDanaCarveyMikeMeyersMovies3.1.1DefinitionofFunctionalDependencyConsiderthefunctionaldependenciesinstudent(stuid,name,gender,depid,dorm,courseid,coursename,score).stuid→namegender?name→gend
8、er?stuid→score?stuid→courseid?stuidcourseid→score?3.14.2KeysofRelationsKey:Wesayasetofoneormoreattributes{A1,A