最新数据库系统基础教程第五章答案.docx

上传人:b****8 文档编号:10445466 上传时间:2023-02-11 格式:DOCX 页数:21 大小:23.10KB
下载 相关 举报
最新数据库系统基础教程第五章答案.docx_第1页
第1页 / 共21页
最新数据库系统基础教程第五章答案.docx_第2页
第2页 / 共21页
最新数据库系统基础教程第五章答案.docx_第3页
第3页 / 共21页
最新数据库系统基础教程第五章答案.docx_第4页
第4页 / 共21页
最新数据库系统基础教程第五章答案.docx_第5页
第5页 / 共21页
点击查看更多>>
下载资源
资源描述

最新数据库系统基础教程第五章答案.docx

《最新数据库系统基础教程第五章答案.docx》由会员分享,可在线阅读,更多相关《最新数据库系统基础教程第五章答案.docx(21页珍藏版)》请在冰豆网上搜索。

最新数据库系统基础教程第五章答案.docx

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

Exercise5.1.1

Asaset:

speed

2.66

2.10

1.42

2.80

3.20

2.20

2.00

1.86

3.06

Average=2.37

Asabag:

speed

2.66

2.10

1.42

2.80

3.20

3.20

2.20

2.20

2.00

2.80

1.86

2.80

3.06

Average=2.48

Exercise5.1.2

Asaset:

hd

250

80

320

200

300

160

Average=218

Asabag:

hd

250

250

80

250

250

320

200

250

250

300

160

160

80

Average=215

Exercise5.1.3a

Asaset:

bore

15

16

14

18

Asabag:

bore

15

16

14

16

15

15

14

18

Exercise5.1.3b

πbore(Ships

Classes)

Exercise5.1.4a

Forbags:

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.4b

Forbags:

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.4c

Forbags:

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.4d

Forbags:

SupposeatupletoccursnandmtimesinbagsRandSrespectively.IntheunionofthesetwobagsR⋃S,tupletwouldappearn+mtimes.Likewise,intheunionofthesetwobagsS⋃R,tupletwouldappearm+ntimes.Bothsidesoftherelationyieldthesameresult.

Forsets:

Atupletcanonlyappearatmostonetime.TupletmightappeareachinsetsRandSoneorzerotimes.ThecombinationsofnumberofoccurrencesfortupletinRandSrespectivelyare(0,0),(0,1),(1,0),and(1,1).OnlywhentupletappearsinbothsetsRandSwilltheunionR⋃Shavethetuplet.ThesamereasoningholdswhenwetaketheunionS⋃R.

Thereforethecommutativelawforunionholds.

Exercise5.1.4e

Forbags:

SupposeatupletoccursnandmtimesinbagsRandSrespectively.IntheintersectionofthesetwobagsR∩S,tupletwouldappearmin(n,m)times.LikewiseintheintersectionofthesetwobagsS∩R,tupletwouldappearmin(m,n)times.Bothsidesoftherelationyieldthesameresult.

Forsets:

Atupletcanonlyappearatmostonetime.TupletmightappeareachinsetsRandSoneorzerotimes.ThecombinationsofnumberofoccurrencesfortupletinRandSrespectivelyare(0,0),(0,1),(1,0),and(1,1).OnlywhentupletappearsinatleastoneofthesetsRandSwilltheintersectionR∩Shavethetuplet.ThesamereasoningholdswhenwetaketheintersectionS∩R.

Thereforethecommutativelawforintersectionholds.

Exercise5.1.4f

Forbags:

SupposeatupletoccursntimesinbagRandtupleuoccursmtimesinbagS.Supposealsothatthetwotuplest,ucansuccessfullyjoin.TheninthenaturaljoinofthesetwobagsR

S,thejoinedtuplewouldappearnmtimes.LikewiseinthenaturaljoinofthesetwobagsS

R,thejoinedtuplewouldappearmntimes.Bothsidesoftherelationyieldthesameresult.

Forsets:

Anarbitrarytupletcanonlyappearatmostonetimeinanyset.Tuplesu,vmightappearrespectivelyinsetsRandSoneorzerotimes.Thecombinationsofnumberofoccurrencesfortuplesu,vinRandSrespectivelyare(0,0),(0,1),(1,0),and(1,1).OnlywhentupleuexistsinRandtuplevexistsinSwillthenaturaljoinR

Shavethejoinedtuple.ThesamereasoningholdswhenwetakethenaturaljoinS

R.

Thereforethecommutativelawfornaturaljoinholds.

Exercise5.1.4g

Forbags:

SupposetupletappearsmtimesinRandntimesinS.IfwetaketheunionofRandSfirst,wewillgetarelationwheretupletappearsm+ntimes.TakingtheprojectionofalistofattributesLwillyieldaresultingrelationwheretheprojectedattributesfromtupletappearm+ntimes.IfwetaketheprojectionoftheattributesinlistLfirst,thentheprojectedattributesfromtupletwouldappearmtimesfromRandntimesfromS.Theunionoftheseresultingrelationswouldhavetheprojectedattributesoftupletappearm+ntimes.

Forsets:

Anarbitrarytupletcanonlyappearatmostonetimeinanyset.TupletmightappearinsetsRandSoneorzerotimes.ThecombinationsofnumberofoccurrencesfortupletinRandSrespectivelyare(0,0),(0,1),(1,0),and(1,1).OnlywhentupletexistsinRorS(orbothRandS)willtheprojectedattributesoftupletappearintheresult.

Thereforethelawholds.

Exercise5.1.4h

Forbags:

SupposetupletappearsutimesinR,vtimesinSandwtimesinT.Onthelefthandside,theintersectionofSandTwouldproducearesultwheretupletwouldappearmin(v,w)times.WiththeadditionoftheunionofR,theoverallresultwouldhaveu+min(v,w)copiesoftuplet.Ontherighthandside,wewouldgetaresultofmin(u+v,u+w)copiesoftuplet.Theexpressionsonboththeleftandrightsidesareequivalent.

Forsets:

Anarbitrarytupletcanonlyappearatmostonetimeinanyset.TupletmightappearinsetsR,SandToneorzerotimes.ThecombinationsofnumberofoccurrencesfortupletinR,SandTrespectivelyare(0,0,0),(0,0,1),(0,1,0),(0,1,1),(1,0,0),(1,0,1),(1,1,0)and(1,1,1).OnlywhentupletappearsinRorinbothSandTwilltheresulthavetuplet.

Thereforethedistributivelawofunionoverintersectionholds.

Exercise5.1.4i

SupposethatinrelationR,utuplessatisfyconditionCandvtuplessatisfyconditionD.SupposealsothatwtuplessatisfybothconditionsCandDwherew≤min(v,w).Thenthelefthandsidewillreturnthosewtuples.Ontherighthandside,σC(R)producesutuplesandσD(R)producesvtuples.However,weknowtheintersectionwillproducethesamewtuplesintheresult.

Whenconsideringbagsandsets,theonlydifferenceisbagsallowduplicatetupleswhilesetsonlyallowonecopyofthetuple.Theexampleaboveappliestobothcases.

Thereforethelawholds.

Exercise5.1.5a

Forsets,anarbitrarytupletappearsonthelefthandsideifitappearsinbothR,SandnotinT.Thesameistruefortherighthandside.

Asanexampleforbags,supposethattupletappearsonetimeeachinbothR,TandtwotimesinS.Theresultofthelefthandsidewouldhavezerocopiesoftupletwhiletherighthandsidewouldhaveonecopyoftuplet.

Thereforethelawholdsforsetsbutnotforbags.

Exercise5.1.5b

Forsets,anarbitrarytupletappearsonthelefthandsideifitappearsinRandeitherSorT.ThisisequivalenttosayingtupletonlyappearswhenitisinatleastRandSorinRandT.Theequivalenceisexactlytherightside’sexpression.

Asanexampleforbags,supposethattupletappearsonetimeinRandtwotimeseachinSandT.Thenthelefthandsidewouldhaveonecopyoftupletintheresultwhiletherighthandsidewouldhavetwocopiesoftuplet.

Thereforethelawholdsforsetsbutnotforbags.

Exercise5.1.5c

Forsets,anarbitrarytupletappearsonthelefthandsideifitsatisfiesconditionC,conditionDorbothconditionCandD.Ontherighthandside,σC(R)selectsthosetuplesthatsatisfyconditionCwhileσD(R)selectsthosetuplesthatsatisfyconditionD.However,theunionoperatorwilleliminateduplicatetuples,namelythosetuplesthatsatisfybothconditionCandD.Thusweareensuredthatbothsidesareequivalent.

Asanexampleforbags,weonlyneedtolookattheunionoperator.IfthereareindeedtuplesthatsatisfybothconditionsCandD,

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 农林牧渔 > 水产渔业

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1