TransformationRule(逻辑实现成关系表的规则)

<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 728x15, 创建于 08-4-23MSDN */ google_ad_slot = "3624277373"; google_ad_width = 728; google_ad_height = 15; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 160x600, 创建于 08-4-23MSDN */ google_ad_slot = "4367022601"; google_ad_width = 160; google_ad_height = 600; //--> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>

wordunderlinedisprimarykey
Rule1.EachentityinanE-Rdiagramismappedtoasingletableinarelationaldatabase;thetableisnameaftertheentity.Thecolumnsofthetablerepresentallthesingle-valuedsimpleattributesthatareattachedtotheentity(possiblythroughacompositeattribute,althoughacompositeattributeitsselfdoesnotbecomeacolumnofthetable)。

Rule2:GivenanentityEwithprimaryidentifierp,amulti-valuedattributeaattachedtoEinanE-Rdiagramismappedtoatableofitsown;thetableisnamedafterthepluralmulti-valuedattribute.Thecolumnsofthisnewtablearenamedafterpanda,androwsofthetablecorrespondto(p,a)valuepairs,representingallpairingsofattributevaluesofaassociatedwithentityoccurrencesinE.Theprimarykeyattributeforthistableisthesetofcolumnsinpanda.
EG:(herep==eid,a==hobby)
employes(eid,staddress,city,states,zipcodes)(197,7Beacon,Boston,MA,02102)(221,19BrightonSt,Boston,MA,02103)
hobbies(eid,hobby)(197,chess)(197,painting)(221,reading)

Rules3:N-NRelationships.WhentwoentitiesEandFtakepartinamany-to-manybinaryrelationshipR,therelationshipismappedtoarepresentativetableTintherelatedrelationaldatabasedesign.ThetablecontainscolumnsforallarrtibutesintheprimarykeysofbothtablestransformedfromentitiesEandF,andthissetofcolumnsformstheprimarykeyforthetableT.
EG:(Employees-(1,N)-works_on-(0,N)-Projects        ---N-N(many-to-many) )
employees(eid,straddr,city,state,zipcode) --woks_on(eid,prid,percent)--projects(prid,proj_name,due_date)

Rules4:N-1Relationships.WhentwoentitiesEandFtakepartinamany-to-onebinaryrelationshipR,therlationshipwillnotbemappedtoatableofitsowninarelationaldatabasedesign.Instead,ifweassumethattheentityFhasmax-card(F,R)=1andthusrepresentsthe“many“sideoftherelationship,therelationaltableTtransformedfromtheentityFshouldincludecolumsconstituting theprimarykeyforthetabletransformedfromtheentityE;thisisknownasaforeignkeyinT.
EG:instructors(insid,lname,office_no,ext) --cours_sections(secid,insid,course,room,preriod).

Rules5:1-1Relationships,optionalParticipation.GiventwoentitiesEandFthattakepartinaone-to-onebinaryrelationshipR,whereparticipationisoptionaloneitherside,wewishtotranslatethissituationintoarelaionaldesign --Useforeignkeyoneitherorbothsides.

Rules6:1-1Relationships,MandatoryParticipationonBothSides.Inthecaseofaone-to-onerelationshipwithmandatoryparticpationonbothsides,itis mostappropriateto combinethetablesforthetwoentitiesintoone,andinthiswayavoidanyforeignkeys. 

 

 

 

 

 

 

 

 

 

 
<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 728x15, 创建于 08-4-23MSDN */ google_ad_slot = "3624277373"; google_ad_width = 728; google_ad_height = 15; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 160x600, 创建于 08-4-23MSDN */ google_ad_slot = "4367022601"; google_ad_width = 160; google_ad_height = 600; //--> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
阅读更多
文章标签: office date ext
个人分类: 数据库
想对作者说点什么? 我来说一句

MSTR逻辑表大小的计算

2009年08月18日 113KB 下载

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭