简单生活 发表于 2015-1-16 22:53:24

MYSQL网站制作之Transformation Rule(逻辑完成成干系表...

下面我将描述五个不使用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已被证明是一种适合于在各种情况下管理结构化数据的有效工具。

老尸 发表于 2015-1-20 05:54:03

对一张百万级别的表建游标,同时又没有什么过滤条件,取得游标效率是如果直接SQL查询百万条数据;如果再对每条记录做处理,耗时将更长。

愤怒的大鸟 发表于 2015-1-25 23:11:22

现在是在考虑:如果写到服务器端,我一下搞他个10个存储过程导过去,那久之服务器不就成垃圾箱了吗?即便优化了我的中间层.

深爱那片海 发表于 2015-2-4 09:34:27

分区表效率问题肯定是大家关心的问题。在我的试验中,如果按照分区字段进行的查询(过滤)效率会高于未分区表的相同语句。但是如果按照非分区字段进行查询,效率会低于未分区表的相同语句。

山那边是海 发表于 2015-2-9 21:31:13

比如,MicrosoftSQLServer2008的某一个版本可以满足现在的这个业务的需要,而且价格还比Oracle11g要便宜,那么这一产品就是适合的。

爱飞 发表于 2015-2-27 22:17:24

对递归类的树遍历很有帮助。个人感觉这个真是太棒了!阅读清晰,非常有时代感。

兰色精灵 发表于 2015-3-9 14:52:21

至于淘汰的问题,只能说在你的项目周期之内,微软应该都不会倒闭。

谁可相欹 发表于 2015-3-17 00:06:36

其中最有名的应该是row_number了。这个终于解决了用临时表生成序列号的历史,而且SQLServer2005的row_number比Oracle的更先进。因为它把Orderby集成到了一起,不用像Oracle那样还要用子查询进行封装。

变相怪杰 发表于 2015-3-23 07:29:19

入门没那么困难,精通没那么容易
页: [1]
查看完整版本: MYSQL网站制作之Transformation Rule(逻辑完成成干系表...