|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
下面我将描述五个不使用MySQL的响亮理由。
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,therelationaltableTtransformedfromtheentityFshouldincludecolumsconstitutingtheprimarykeyforthetabletransformedfromtheentityE;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,itismostappropriatetocombinethetablesforthetwoentitiesintoone,andinthiswayavoidanyforeignkeys.
DBaaS和其他云服务之间的区别是:DBaaS专注于提供类似关系数据库管理系统RDBMS(比如SQLServer、MySQL和Oracle)的数据库功能。事实上,RDBMS已被证明是一种适合于在各种情况下管理结构化数据的有效工具。 |
|