数据库系统基础教程第五章答案

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

Exercise5.1.1Asaset:speed2.662.101.422.803.202.202.001.863.06Average=2.37Asabag:speed2.662.101.422.803.203.202.202.202.002.801.862.803.06Average=2.48Exercise5.1.2Asaset:hd25080320200300160Average=218Asabag:hd2502508025025032020025025030016016080Average=215Exercise5.1.3aAsaset:bore15161418Asabag:bore1516141615151418Exercise5.1.3bbore(ShipsClasses)Exercise5.1.4aForbags:Ontheleft-handside:GivenbagsRandSwhereatupletappearsnandmtimesrespectively,theunionofbagsRandSwillhavetupletappearn+mtimes.ThefurtherunionofbagTwiththetupletappearingotimeswillhavetupletappearn+m+otimesinthefinalresult.Ontheright-handside:GivenbagsSandTwhereatupletappearsmandotimesrespectively,theunionofbagsRandSwillhavetupletappearm+otimes.ThefurtherunionofbagRwiththetupletappearingntimeswillhavetupletappearm+o+ntimesinthefinalresult.Forsets:Thisisasimilarcasewhendealingwithbagsexceptthetupletcanonlyappearatmostonceineachset.Thetupletonlyappearsintheresultifallthesetshavethetuplet.Otherwise,thetupletwillnotappearintheresult.Sincewecannothaveduplicates,theresultonlyhasatmostonecopyofthetuplet.Exercise5.1.4bForbags:Ontheleft-handside:GivenbagsRandSwhereatupletappearsnandmtimesrespectively,theintersectionofbagsRandSwillhavetupletappearmin(n,m)times.ThefurtherintersectionofbagTwiththetupletappearingotimeswillproducetupletmin(o,min(n,m))timesinthefinalresult.Ontheright-handside:GivenbagsSandTwhereatupletappearsmandotimesrespectively,theintersectionofbagsRandSwillhavetupletappearmin(m,o)times.ThefurtherintersectionofbagRwiththetupletappearingntimeswillproducetupletmin(n,min(m,o))timesinthefinalresult.TheintersectionofbagsR,SandTwillyieldaresultwheretupletappearsmin(n,m,o)times.Forsets:Thisisasimilarcasewhendealingwithbagsexceptthetupletcanonlyappearatmostonceineachset.Thetupletonlyappearsintheresultifallthesetshavethetuplet.Otherwise,thetupletwillnotappearintheresult.Exercise5.1.4cForbags:Ontheleft-handside:GiventhattuplerinR,whichappearsmtimes,cansuccessfullyjoinwithtuplesinS,whichappearsntimes,weexpecttheresulttocontainmncopies.AlsogiventhattupletinT,whichappearsotimes,cansuccessfullyjoinwiththejoinedtuplesofrands,weexpectthefinalresulttohavemnocopies.Ontheright-handside:GiventhattuplesinS,whichappearsntimes,cansuccessfullyjoinwithtupletinT,whichappearsotimes,weexpecttheresulttocontainnocopies.AlsogiventhattuplerinR,whichappearsmtimes,cansuccessfullyjoinwiththejoinedtuplesofsandt,weexpectthefinalresulttohavenomcopies.Theorderinwhichweperformthenaturaljoindoesnotmatterforbags.Forsets:Thisisasimilarcasewhendealingwithbagsexceptthejoinedtuplescanonlyappearatmostonceineachresult.Iftherearetuplesr,s,tinrelationsR,S,Tthatcansuccessfullyjoin,thentheresultwillcontainatuplewiththeschemaoftheirjoinedattributes.Exercise5.1.4dForbags:SupposeatupletoccursnandmtimesinbagsRandSrespectively.IntheunionofthesetwobagsRS,tupletwouldappearn+mtimes.Likewise,intheunionofthesetwobagsSR,tupletwouldappearm+ntimes.Bothsidesoftherelationyieldthesameresult.Forsets:Atupletcanonlyappearatmostonetime.TupletmightappeareachinsetsRandSoneorzerotimes.ThecombinationsofnumberofoccurrencesfortupletinRandSrespectivelyare(0,0),(0,1),(1,0),and(1,1).OnlywhentupletappearsinbothsetsRandSwilltheunionRShavethetuplet.ThesamereasoningholdswhenwetaketheunionSR.Thereforethecommutativelawforunionholds.Exercise5.1.4eForbags:SupposeatupletoccursnandmtimesinbagsRandSrespectively.IntheintersectionofthesetwobagsRS,tupletwouldappearmin(n,m)times.LikewiseintheintersectionofthesetwobagsSR,tupletwouldappearmin(m,n)times.Bothsidesoftherelationyieldthesameresult.Forsets:Atupletcanonlyappearatmostonetime.TupletmightappeareachinsetsRandSoneorzerotimes.ThecombinationsofnumberofoccurrencesfortupletinRandSrespectivelyare(0,0),(0,1),(1,0),and(1,1).OnlywhentupletappearsinatleastoneofthesetsRandSwilltheintersectionRShavethetuplet.ThesamereasoningholdswhenwetaketheintersectionSR.Thereforethecommutativelawforintersectionholds.Exercise5.1.4fForbags:SupposeatupletoccursntimesinbagRandtupleuoccursmtimesinbagS.Supposealsothatthetwotuplest,ucansuccessfullyjoin.TheninthenaturaljoinofthesetwobagsRS,thejoinedtuplewouldappearnmtimes.LikewiseinthenaturaljoinofthesetwobagsSR,thejoinedtuplewouldappearmntimes.Bothsidesoftherelationyieldthesameresult.Forsets:Anarbitrarytupletcanonlyappearatmostonetimeinanyset.Tuplesu,vmightappearrespectivelyinsetsRandSoneorzerotimes.Thecombinationsofnumberofoccurrencesfortuplesu,vinRandSrespectivelyare(0,0),(0,1),(1,0),and(1,1).OnlywhentupleuexistsinRandtuplevexistsinSwillthenaturaljoinRShavethejoinedtuple.ThesamereasoningholdswhenwetakethenaturaljoinSR.Thereforethecommutativelawfornaturaljoinholds.Exercise5.1.4gForbags:SupposetupletappearsmtimesinRandntimesinS.IfwetaketheunionofRandSfirst,wewillgetarelationwheretupletappearsm+ntimes.TakingtheprojectionofalistofattributesLwillyieldaresultingrelationwheretheprojectedattributesfromtupletappearm+ntimes.IfwetaketheprojectionoftheattributesinlistLfirst,thentheprojectedattributesfromtupletwouldappearmtimesfromRandntimesfromS.Theunionoftheseresultingrelati

1 / 16
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功