数据库系统基础教程第三章答案.docx
《数据库系统基础教程第三章答案.docx》由会员分享,可在线阅读,更多相关《数据库系统基础教程第三章答案.docx(33页珍藏版)》请在冰豆网上搜索。
![数据库系统基础教程第三章答案.docx](https://file1.bdocx.com/fileroot1/2022-10/10/8b1f2a67-283d-434e-8ca4-0adef3847077/8b1f2a67-283d-434e-8ca4-0adef38470771.gif)
数据库系统基础教程第三章答案
Exercise3、1、1
Answersforthisexercisemayvarybecauseofdifferentinterpretations、
SomepossibleFDs:
SocialSecuritynumber→name
Areacode→state
Streetaddress,city,state→zipcode
Possiblekeys:
{SocialSecuritynumber,streetaddress,city,state,areacode,phonenumber}
Needstreetaddress,city,statetouniquelydeterminelocation、Apersoncouldhavemultipleaddresses、Thesameistrueforphones、Thesedays,apersoncouldhavealandlineandacellularphone
Exercise3、1、2
Answersforthisexercisemayvarybecauseofdifferentinterpretations
SomepossibleFDs:
ID→x-position,y-position,z-position
ID→x-velocity,y-velocity,z-velocity
x-position,y-position,z-position→ID
Possiblekeys:
{ID}
{x-position,y-position,z-position}
Thereasonwhythepositionswouldbeakeyisnotwomoleculescanoccupythesamepoint、
Exercise3、1、3a
ThesuperkeysareanysubsetthatcontainsA1、Thus,thereare2(n-1)suchsubsets,sinceeachofthen-1attributesA2throughAnmayindependentlybechoseninorout、
Exercise3、1、3b
ThesuperkeysareanysubsetthatcontainsA1orA2、Thereare2(n-1)suchsubsetswhenconsideringA1andthen-1attributesA2throughAn、Thereare2(n-2)suchsubsetswhenconsideringA2andthen-2attributesA3throughAn、WedonotcountA1inthesesubsetsbecausetheyarealreadycountedinthefirstgroupofsubsets、Thetotalnumberofsubsetsis2(n-1)+2(n-2)、
Exercise3、1、3c
Thesuperkeysareanysubsetthatcontains{A1,A2}or{A3,A4}、Thereare2(n-2)suchsubsetswhenconsidering{A1,A2}andthen-2attributesA3throughAn、Thereare2(n-2)–2(n-4)suchsubsetswhenconsidering{A3,A4}andattributesA5throughAnalongwiththeindividualattributesA1andA2、Wegetthe2(n-4)termbecausewehavetodiscardthesubsetsthatcontainthekey{A1,A2}toavoiddoublecounting、Thetotalnumberofsubsetsis2(n-2)+2(n-2)–2(n-4)、
Exercise3、1、3d
Thesuperkeysareanysubsetthatcontains{A1,A2}or{A1,A3}、Thereare2(n-2)suchsubsetswhenconsidering{A1,A2}andthen-2attributesA3throughAn、Thereare2(n-3)suchsubsetswhenconsidering{A1,A3}andthen-3attributesA4throughAnWedonotcountA2inthesesubsetsbecausetheyarealreadycountedinthefirstgroupofsubsets、Thetotalnumberofsubsetsis2(n-2)+2(n-3)、
Exercise3、2、1a
Wecouldtryinferencerulestodeducenewdependenciesuntilwearesatisfiedwehavethemall、Amoresystematicwayistoconsidertheclosuresofall15nonemptysetsofattributes、
Forthesingleattributeswehave{A}+=A,{B}+=B,{C}+=ACD,and{D}+=AD、Thus,theonlynewdependencywegetwithasingleattributeontheleftisC→A、
Nowconsiderpairsofattributes:
{AB}+=ABCD,sowegetnewdependencyAB→D、{AC}+=ACD,andAC→Disnontrivial、{AD}+=AD,sonothingnew、{BC}+=ABCD,sowegetBC→A,andBC→D、{BD}+=ABCD,givingusBD→AandBD→C、{CD}+=ACD,givingCD→A、
Forthetriplesofattributes,{ACD}+=ACD,buttheclosuresoftheothersetsareeachABCD、Thus,wegetnewdependenciesABC→D,ABD→C,andBCD→A、
Since{ABCD}+=ABCD,wegetnonewdependencies、
Thecollectionof11newdependenciesmentionedaboveare:
C→A,AB→D,AC→D,BC→A,BC→D,BD→A,BD→C,CD→A,ABC→D,ABD→C,andBCD→A、
Exercise3、2、1b
Fromtheanalysisofclosuresabove,wefindthatAB,BC,andBDarekeys、AllothersetseitherdonothaveABCDastheclosureorcontainoneofthesethreesets、
Exercise3、2、1c
Thesuperkeysareallthosethatcontainoneofthosethreekeys、Thatis,asuperkeythatisnotakeymustcontainBandmorethanoneofA,C,andD、Thus,the(proper)superkeysareABC,ABD,BCD,andABCD、
Exercise3、2、2a
i)Forthesingleattributeswehave{A}+=ABCD,{B}+=BCD,{C}+=C,and{D}+=D、Thus,thenewdependenciesareA→CandA→D、
Nowconsiderpairsofattributes:
{AB}+=ABCD,{AC}+=ABCD,{AD}+=ABCD,{BC}+=BCD,{BD}+=BCD,{CD}+=CD、ThusthenewdependenciesareAB→C,AB→D,AC→B,AC→D,AD→B,AD→C,BC→DandBD→C、
Forthetriplesofattributes,{BCD}+=BCD,buttheclosuresoftheothersetsareeachABCD、Thus,wegetnewdependenciesABC→D,ABD→C,andACD→B、
Since{ABCD}+=ABCD,wegetnonewdependencies、
Thecollectionof13newdependenciesmentionedaboveare:
A→C,A→D,AB→C,AB→D,AC→B,AC→D,AD→B,AD→C,BC→D,BD→C,ABC→D,ABD→CandACD→B、
ii)Forthesingleattributeswehave{A}+=A,{B}+=B,{C}+=C,and{D}+=D、Thus,therearenonewdependencies、
Nowconsiderpairsofattributes:
{AB}+=ABCD,{AC}+=AC,{AD}+=ABCD,{BC}+=ABCD,{BD}+=BD,{CD}+=ABCD、ThusthenewdependenciesareAB→D,AD→C,BC→AandCD→B、
Forthetriplesofattributes,alltheclosuresofthesetsareeachABCD、Thus,wegetnewdependenciesABC→D,ABD→C,ACD→BandBCD→A、
Since{ABCD}+=ABCD,wegetnonewdependencies、
Thecollectionof8newdependenciesmentionedaboveare:
AB→D,AD