这是数据库之父对实现关系型数据库管理系统的12条建议:
Codd's12Rules
Dr.E.F.Codd,anIBMresearcher,firstdevelopedtherelationaldatamodelin1970.In1985,Dr.Coddpublishedalistof12rulesthatconciselydefineanidealrelationaldatabase,whichhaveprovidedaguidelineforthedesignofallrelationaldatabasesystemseversince.
Iusetheterm"guideline"because,todate,nocommercialrelationaldatabasesystemfullyconformstoall12rules.Theydorepresenttherelationalideal,though.Forafewyears,scorecardswerekeptthatratedeachcommercialproduct'sconformitytoCodd'srules.Today,therulesarenottalkedaboutasmuchbutremainagoalforrelationaldatabasedesign.
FollowingisalistofCodd's12rules,includinghisoriginalnameforeachruleandasimplifieddescription.Ialsohaveincludedanotewherecertainrulesareproblematictoimplement.Don'tworryifsomeoftheseitemsareconfusingtoyou,aswemovefurtherthroughthisnewsletterserieswewillfillinthedetails.
Rule1:TheInformationRule
Alldatashouldbepresentedtotheuserintableform.Lastweek'snewsletteralreadydiscussedthebasicsofthisrule.
Rule2:GuaranteedAccessRule
Alldatashouldbeaccessiblewithoutambiguity.Thiscanbeaccomplishedthroughacombinationofthetablename,primarykey,andcolumnname.
Rule3:SystematicTreatmentofNullValues
Afieldshouldbeallowedtoremainempty.Thisinvolvesthesupportofanullvalue,whichisdistinctfromanemptystringoranumberwithavalueofzero.Ofcourse,thiscan'tapplytoprimarykeys.Inaddition,mostdatabaseimplementationssupporttheconceptofanun-nullfieldconstraintthatpreventsnullvaluesinaspecifictablecolumn.
Rule4:DynamicOn-LineCatalogBasedontheRelationalModelArelationaldatabasemustprovideaccesstoitsstructurethroughthesametoolsthatareusedtoaccessthedata.Thisisusuallyaccomplishedbystoringthestructuredefinitionwithinspecialsystemtables.
Rule5:ComprehensiveDataSublanguageRule
Thedatabasemustsupportatleastoneclearlydefinedlanguagethatincludesfunctionalityfordatadefinition,datamanipulation,dataintegrity,anddatabasetransactioncontrol.AllcommercialrelationaldatabasesuseformsofthestandardSQL(StructuredQueryLanguage)astheirsupportedcomprehensivelanguage.
Rule6:ViewUpdatingRule
Datacanbepresentedtotheuserindifferentlogicalcombinations,calledviews.Eachviewshouldsupportthesamefullrangeofdatamanipulationthatdirect-accesstoatablehasavailable.Inpractice,providingupdateanddeleteaccesstologicalviewsisdifficultandisnotfullysupportedbyanycurrentdatabase.
Rule7:High-levelInsert,Update,andDelete
Datacanberetrievedfromarelationaldatabaseinsetsconstructedofdatafrommultiplerowsand/ormultipletables.Thisrulestatesthatinsert,update,anddeleteoperationsshouldbesupportedforanyretrievablesetratherthanjustforasinglerowinasingletable.
Rule8:PhysicalDataIndependence
Theuserisisolatedfromthephysicalmethodofstoringandretrievinginformationfromthedatabase.Changescanbemadetotheunderlyingarchitecture(hardware,diskstoragemethods)withoutaffectinghowtheuseraccessesit.
Rule9:LogicalDataIndependence
Howauserviewsdatashouldnotchangewhenthelogicalstructure(tablesstructure)ofthedatabasechanges.Thisruleisparticularlydifficulttosatisfy.Mostdatabasesrelyonstrongtiesbetweentheuserviewofthedataandtheactualstructureoftheunderlyingtables.
Rule10:IntegrityIndependence
Thedatabaselanguage(likeSQL)shouldsupportconstraintsonuserinputthatmaintaindatabaseintegrity.Thisruleisnotfullyimplementedbymostmajorvendors.Ataminimum,alldatabasesdopreservetwoconstraintsthroughSQL.Nocomponentofaprimarykeycanhaveanullvalue.(seerule3)
Ifaforeignkeyisdefinedinonetable,anyvalueinitmustexistasaprimarykeyinanothertable.
Rule11:DistributionIndependence
Ausershouldbetotallyunawareofwhetherornotthedatabaseisdistributed(whetherpartsofthedatabaseexistinmultiplelocations).Avarietyofreasonsmakethisruledifficulttoimplement;Iwillspendtimeaddressingthesereasonswhenwediscussdistributeddatabases.
Rule12:NonsubversionRule
Thereshouldbenowaytomodifythedatabasestructureotherthanthroughthemultiplerowdatabaselanguage(likeSQL).Mostdatabasestodaysupportadministrativetoolsthatallowsomedirectmanipulationofthedatastructure.Overthelifeofthisnewsletter,IwillbeexpandingontheconceptscoveredbyeachofCodd'srules.Iwillusetherelationalquerylanguageofchoice,SQL,toillustratetheseconceptsandexplainrelationaldatabasestructureindetail.
转自: http://www.zhanling.com/zhanling/qiu/blogview.asp?logID=83&cateID=3
Codd's12Rules
Dr.E.F.Codd,anIBMresearcher,firstdevelopedtherelationaldatamodelin1970.In1985,Dr.Coddpublishedalistof12rulesthatconciselydefineanidealrelationaldatabase,whichhaveprovidedaguidelineforthedesignofallrelationaldatabasesystemseversince.
Iusetheterm"guideline"because,todate,nocommercialrelationaldatabasesystemfullyconformstoall12rules.Theydorepresenttherelationalideal,though.Forafewyears,scorecardswerekeptthatratedeachcommercialproduct'sconformitytoCodd'srules.Today,therulesarenottalkedaboutasmuchbutremainagoalforrelationaldatabasedesign.
FollowingisalistofCodd's12rules,includinghisoriginalnameforeachruleandasimplifieddescription.Ialsohaveincludedanotewherecertainrulesareproblematictoimplement.Don'tworryifsomeoftheseitemsareconfusingtoyou,aswemovefurtherthroughthisnewsletterserieswewillfillinthedetails.
Rule1:TheInformationRule
Alldatashouldbepresentedtotheuserintableform.Lastweek'snewsletteralreadydiscussedthebasicsofthisrule.
Rule2:GuaranteedAccessRule
Alldatashouldbeaccessiblewithoutambiguity.Thiscanbeaccomplishedthroughacombinationofthetablename,primarykey,andcolumnname.
Rule3:SystematicTreatmentofNullValues
Afieldshouldbeallowedtoremainempty.Thisinvolvesthesupportofanullvalue,whichisdistinctfromanemptystringoranumberwithavalueofzero.Ofcourse,thiscan'tapplytoprimarykeys.Inaddition,mostdatabaseimplementationssupporttheconceptofanun-nullfieldconstraintthatpreventsnullvaluesinaspecifictablecolumn.
Rule4:DynamicOn-LineCatalogBasedontheRelationalModelArelationaldatabasemustprovideaccesstoitsstructurethroughthesametoolsthatareusedtoaccessthedata.Thisisusuallyaccomplishedbystoringthestructuredefinitionwithinspecialsystemtables.
Rule5:ComprehensiveDataSublanguageRule
Thedatabasemustsupportatleastoneclearlydefinedlanguagethatincludesfunctionalityfordatadefinition,datamanipulation,dataintegrity,anddatabasetransactioncontrol.AllcommercialrelationaldatabasesuseformsofthestandardSQL(StructuredQueryLanguage)astheirsupportedcomprehensivelanguage.
Rule6:ViewUpdatingRule
Datacanbepresentedtotheuserindifferentlogicalcombinations,calledviews.Eachviewshouldsupportthesamefullrangeofdatamanipulationthatdirect-accesstoatablehasavailable.Inpractice,providingupdateanddeleteaccesstologicalviewsisdifficultandisnotfullysupportedbyanycurrentdatabase.
Rule7:High-levelInsert,Update,andDelete
Datacanberetrievedfromarelationaldatabaseinsetsconstructedofdatafrommultiplerowsand/ormultipletables.Thisrulestatesthatinsert,update,anddeleteoperationsshouldbesupportedforanyretrievablesetratherthanjustforasinglerowinasingletable.
Rule8:PhysicalDataIndependence
Theuserisisolatedfromthephysicalmethodofstoringandretrievinginformationfromthedatabase.Changescanbemadetotheunderlyingarchitecture(hardware,diskstoragemethods)withoutaffectinghowtheuseraccessesit.
Rule9:LogicalDataIndependence
Howauserviewsdatashouldnotchangewhenthelogicalstructure(tablesstructure)ofthedatabasechanges.Thisruleisparticularlydifficulttosatisfy.Mostdatabasesrelyonstrongtiesbetweentheuserviewofthedataandtheactualstructureoftheunderlyingtables.
Rule10:IntegrityIndependence
Thedatabaselanguage(likeSQL)shouldsupportconstraintsonuserinputthatmaintaindatabaseintegrity.Thisruleisnotfullyimplementedbymostmajorvendors.Ataminimum,alldatabasesdopreservetwoconstraintsthroughSQL.Nocomponentofaprimarykeycanhaveanullvalue.(seerule3)
Ifaforeignkeyisdefinedinonetable,anyvalueinitmustexistasaprimarykeyinanothertable.
Rule11:DistributionIndependence
Ausershouldbetotallyunawareofwhetherornotthedatabaseisdistributed(whetherpartsofthedatabaseexistinmultiplelocations).Avarietyofreasonsmakethisruledifficulttoimplement;Iwillspendtimeaddressingthesereasonswhenwediscussdistributeddatabases.
Rule12:NonsubversionRule
Thereshouldbenowaytomodifythedatabasestructureotherthanthroughthemultiplerowdatabaselanguage(likeSQL).Mostdatabasestodaysupportadministrativetoolsthatallowsomedirectmanipulationofthedatastructure.Overthelifeofthisnewsletter,IwillbeexpandingontheconceptscoveredbyeachofCodd'srules.Iwillusetherelationalquerylanguageofchoice,SQL,toillustratetheseconceptsandexplainrelationaldatabasestructureindetail.
转自: http://www.zhanling.com/zhanling/qiu/blogview.asp?logID=83&cateID=3