数据库系统基础教程第五章答案.docx
- 文档编号:5551014
- 上传时间:2022-12-19
- 格式:DOCX
- 页数:30
- 大小:28.44KB
数据库系统基础教程第五章答案.docx
《数据库系统基础教程第五章答案.docx》由会员分享,可在线阅读,更多相关《数据库系统基础教程第五章答案.docx(30页珍藏版)》请在冰豆网上搜索。
数据库系统基础教程第五章答案
精品文档
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
π(ShipsClasses)
bore
Exercise5.1.4a
Forbags:
Ontheleft-handside:
GivenbagsRandSwhereatupletappearsnandmtimesrespectively,theunionofbags
RandSwillhavetupletappearn+mtimes.ThefurtherunionofbagTwiththetuplet
appearingotimeswillhavetupletappearn+m+otimesinthefinalresult.
Ontheright-handside:
GivenbagsSandTwhereatupletappearsmandotimesrespectively,theunionofbags
RandSwillhavetupletappearm+otimes.ThefurtherunionofbagRwiththetuplet
appearingntimeswillhavetupletappearm+o+ntimesinthefinalresult.
Forsets:
Thisisasimilarcasewhendealingwithbagsexceptthetupletcanonlyappearatmostoncein
eachset.Thetupletonlyappearsintheresultifallthesetshavethetuplet.Otherwise,thetuple
twillnotappearintheresult.Sincewecannothaveduplicates,theresultonlyhasatmostone
copyofthetuplet.
Exercise5.1.4b
Forbags:
Ontheleft-handside:
精品文档.
精品文档
GivenbagsRandSwhereatupletappearsnandmtimesrespectively,theintersection
ofbagsRandSwillhavetupletappearmin(n,m)times.Thefurtherintersectionofbag
Twiththetupletappearingotimeswillproducetupletmin(o,min(n,m))timesinthe
finalresult.
Ontheright-handside:
GivenbagsSandTwhereatupletappearsmandotimesrespectively,theintersectionof
bagsRandSwillhavetupletappearmin(m,o)times.ThefurtherintersectionofbagR
withthetupletappearingntimeswillproducetupletmin(n,min(m,o))timesinthe
finalresult.
TheintersectionofbagsR,SandTwillyieldaresultwheretupletappearsmin(n,m,o)times.
Forsets:
Thisisasimilarcasewhendealingwithbagsexceptthetupletcanonlyappearatmostoncein
eachset.Thetupletonlyappearsintheresultifallthesetshavethetuplet.Otherwise,thetuple
twillnotappearintheresult.
Exercise5.1.4c
Forbags:
Ontheleft-handside:
GiventhattuplerinR,whichappearsmtimes,cansuccessfullyjoinwithtuplesinS,
whichappearsntimes,weexpecttheresulttocontainmncopies.Alsogiventhattuplet
inT,whichappearsotimes,cansuccessfullyjoinwiththejoinedtuplesofrands,we
expectthefinalresulttohavemnocopies.
Ontheright-handside:
GiventhattuplesinS,whichappearsntimes,cansuccessfullyjoinwithtupletinT,
whichappearsotimes,weexpecttheresulttocontainnocopies.Alsogiventhattupler
inR,whichappearsmtimes,cansuccessfullyjoinwiththejoinedtuplesofsandt,we
expectthefinalresulttohavenomcopies.
Theorderinwhichweperformthenaturaljoindoesnotmatterforbags.
Forsets:
Thisisasimilarcasewhendealingwithbagsexceptthejoinedtuplescanonlyappearatmost
onceineachresult.Iftherearetuplesr,s,tinrelationsR,S,Tthatcansuccessfullyjoin,thenthe
resultwillcontainatuplewiththeschemaoftheirjoinedattributes.
Exercise5.1.4d
Forbags:
精品文档.
精品文档
SupposeatupletoccursnandmtimesinbagsRandSrespectively.Intheunionofthesetwo
bagsR?
S,tupletwouldappearn+mtimes.Likewise,intheunionofthesetwobagsS?
R,
tupletwouldappearm+ntimes.Bothsidesoftherelationyieldthesameresult.
Forsets:
Atupletcanonlyappearatmostonetime.TupletmightappeareachinsetsRandSoneorzero
times.ThecombinationsofnumberofoccurrencesfortupletinRandSrespectivelyare(0,0),
(0,1),(1,0),and(1,1).OnlywhentupletappearsinbothsetsRandSwilltheunionR?
Shave
thetuplet.ThesamereasoningholdswhenwetaketheunionS?
R.
Thereforethecommutativelawforunionholds.
Exercise5.1.4e
Forbags:
SupposeatupletoccursnandmtimesinbagsRandSrespectively.Intheintersectionofthese
twobagsR∩S,tupletwouldappearmin(n,m)times.Likewiseintheintersectionofthesetwo
bagsS∩R,tupletwouldappearmin(m,n)times.Bothsidesoftherelationyieldthesame
result.
Forsets:
Atupletcanonlyappearatmostonetime.TupletmightappeareachinsetsRandSoneorzero
times.ThecombinationsofnumberofoccurrencesfortupletinRandSrespectivelyare(0,0),
(0,1),(1,0),and(1,1).OnlywhentupletappearsinatleastoneofthesetsRandSwillthe
intersectionR∩Shavethetuplet.ThesamereasoningholdswhenwetaketheintersectionS∩
R.
Thereforethecommutativelawforintersectionholds.
Exercise5.1.4f
Forbags:
SupposeatupletoccursntimesinbagRandtupleuoccursmtimesinbagS.Supposealsothat
thetwotuplest,ucansuccessfullyjoin.TheninthenaturaljoinofthesetwobagsRS,the
joinedtuplewouldappearnmtimes.LikewiseinthenaturaljoinofthesetwobagsSR,the
joinedtuplewouldappearmntimes.Bothsidesoftherelationyieldthesameresult.
Forsets:
Anarbitrarytupletcanonlyappearatmostonetimeinanyset.Tuplesu,vmightappear
respectivelyinsetsRandSoneorzerotimes.Thecombinationsofnumberofoccurrencesfor
tuplesu,vinRandSrespectivelyare(0,0),(0,1),(1,0),and(1,1).OnlywhentupleuexistsinR
精品文档.
精品文档
andtuplevexistsinSwillthenaturaljoinRShavethejoinedtuple.Thesamereasoning
holdswhenwetakethenaturaljoinSR.
Thereforethecommutativelawfornaturaljoinholds.
Exercise5.1.4g
Forbags:
SupposetupletappearsmtimesinRandntimesinS.IfwetaketheunionofRandSfirst,we
willgetarelationwheretupletappearsm+ntimes.TakingtheprojectionofalistofattributesL
willyieldaresultingrelationwheretheprojectedattributesfromtupletappearm+ntimes.If
wetaketheprojectionoftheattributesinlistLfirst,thentheprojectedattributesfromtuplet
wouldappearmtimesfromRandntimesfromS.Theunionoftheseresultingrelationswould
havetheprojectedattributesoftupletappearm+ntimes.
Forsets:
Anarbitrarytupletcanonlyappearatmostonetimeinanyset.TupletmightappearinsetsR
andSoneorzerotimes.ThecombinationsofnumberofoccurrencesfortupletinRandS
respectivelyare(0,0),(0,1),(1,0),and(1,1).OnlywhentupletexistsinRorS(orbothRandS)
willtheprojectedattributesoftupletappearintheresult.
Thereforethelawholds.
Exercise5.1.4h
Forbags:
SupposetupletappearsutimesinR,vtimesinSandwtimesinT.Onthelefthandside,the
intersectionofSandTwouldproducearesultwheretupletwouldappearmin(v,w)times.With
theadditionoftheunionofR,theoverallresultwouldhaveu+min(v,w)copiesoftuplet.On
therighthandside,wewouldgetaresultofmin(u+v,u+w)copiesoftuplet.Theexpressions
onboththeleftandrightsidesareequivalent.
Forsets:
Anarbitrarytupletcanonlyappearatmostonetimeinanyset.TupletmightappearinsetsR,S
andToneorzerotimes.ThecombinationsofnumberofoccurrencesfortupletinR,SandT
respectivelyare(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).Onlywhen
tupletappearsinRorinbothSandTwilltheresulthavetuplet.
Thereforethedistributivelawofunionoverintersectionholds.
Exercise5.1.4i
精品文档.
精品文档
SupposethatinrelationR,utuplessatisfyconditionCandvtuplessatisfyconditionD.Suppose
alsothatwtuplessatisfybothconditionsCandDwherew≤min(v,w).Thenthelefthandside
willreturnthosewtuples.Ontherighthandside,σ(R)producesutuplesandσ(R)producesvDCtuples.However,weknowtheintersectionwillproducethesamewtuplesintheresult.
Whenconsideringbagsandsets,theonlydifferenceisbagsallowduplicatetupleswhilesets
onlyallowonecopyofthetuple.Theexampleaboveappliestobothcases.
Thereforethelawholds.
Exercise5.1.5a
Forsets,anarbitrarytupletappearsonthelefthandsideifitappearsinbothR,SandnotinT.
Thesameistruefortherighthandside.
Asanexampleforbags,supposethattupletappearsonetimeeachinbothR,Tandtwotimesin
S.Theresultofthelefthandsidewouldhavezerocopiesoftupletwhiletherighthandside
wouldhaveonecopyoftuplet.
Thereforethelawholdsforsetsbutnotforbags.
Exercise5.1.5b
Forsets,anarbitrarytupletappearsonthelefthandsideifitappearsinRandeitherSorT.This
isequivalenttosayingtupletonlyappearswhenitisinatleastRandSorinRandT.The
equivalenceisexactlytherightside'sexpression.
Asanexampleforbags,supposethattupletappearsonetimeinRandtwotimeseachinSandT.
Thenthelefthandsidewouldhaveonecopyoftupletintheresultwhiletherighthandside
wouldhavetwocopiesoftuplet.
Thereforethelawholdsforsetsbutnotforbags.
Exercise
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 数据库 系统 基础教程 第五 答案
![提示](https://static.bdocx.com/images/bang_tan.gif)