大学毕业设计关于数据库外文翻译2篇.doc
《大学毕业设计关于数据库外文翻译2篇.doc》由会员分享,可在线阅读,更多相关《大学毕业设计关于数据库外文翻译2篇.doc(25页珍藏版)》请在冰点文库上搜索。
重庆理工大学2013届本科生毕业设计(论文)外文文献翻译
原文:
StructureoftheRelationaldatabase
—《DatabaseSystemConcepts》Part1:
RelationalDatabases
Therelationalmodelisthebasisforanyrelationaldatabasemanagementsystem(RDBMS).Arelationalmodelhasthreecorecomponents:
acollectionofobjectsorrelations,operatorsthatactontheobjectsorrelations,anddataintegritymethods.Inotherwords,ithasaplacetostorethedata,awaytocreateandretrievethedata,andawaytomakesurethatthedataislogicallyconsistent.
Arelationaldatabaseusesrelations,ortwo-dimensionaltables,tostoretheinformationneededtosupportabusiness.Let'sgooverthebasiccomponentsofatraditionalrelationaldatabasesystemandlookathowarelationaldatabaseisdesigned.Onceyouhaveasolidunderstandingofwhatrows,columns,tables,andrelationshipsare,you'llbewellonyourwaytoleveragingthepowerofarelationaldatabase.
Tables,Row,andColumns
Atableinarelationaldatabase,alternativelyknownasarelation,isatwo-dimensionalstructureusedtoholdrelatedinformation.Adatabaseconsistsofoneormorerelatedtables.
Note:
Don'tconfusearelationwithrelationships.Arelationisessentiallyatable,andarelationshipisawaytocorrelate,join,orassociatetwotables.
Arowinatableisacollectionorinstanceofonething,suchasoneemployeeoronelineitemonaninvoice.Acolumncontainsalltheinformationofasingletype,andthepieceofdataattheintersectionofarowandacolumn,afield,isthesmallestpieceofinformationthatcanberetrievedwiththedatabase'squerylanguage.Forexample,atablewithinformationaboutemployeesmighthaveacolumncalledLAST_NAMEthatcontainsalloftheemployees'lastnames.Dataisretrievedfromatablebyfilteringonboththerowandthecolumn.
PrimaryKeys,Datatypes,andForeignKeys
TheexamplesthroughoutthisarticlewillfocusonthehypotheticalworkofScottSmith,databasedeveloperandentrepreneur.HejuststartedanewwidgetcompanyandwantstoimplementafewofthebasicbusinessfunctionsusingtherelationaldatabasetomanagehisHumanResources(HR)department.
Relation:
Atwo-dimensionalstructureusedtoholdrelatedinformation,alsoknownasatable.
Note:
MostofScott'semployeeswerehiredawayfromoneofhispreviousemployers,someofwhomhaveover20yearsofexperienceinthefield.Asahiringincentive,Scotthasagreedtokeepthenewemployees'originalhiredateinthenewdatabase.
Row:
Agroupofoneormoredataelementsinadatabasetablethatdescribesaperson,place,orthing.
Column:
Thecomponentofadatabasetablethatcontainsallofthedataofthesamenameandtypeacrossallrows.
You'lllearnaboutdatabasedesigninthefollowingsections,butlet'sassumeforthemomentthatthemajorityofthedatabasedesigniscompletedandsometablesneedtobeimplemented.ScottcreatestheEMPtabletoholdthebasicemployeeinformation,anditlookssomethinglikethis:
NoticethatsomefieldsintheCommission(COMM)andManager(MGR)columnsdonotcontainavalue;theyareblank.Arelationaldatabasecanenforcetherulethatfieldsinacolumnmayormaynotbeempty.Inthiscase,itmakessenseforanemployeewhoisnotintheSalesdepartmenttohaveablankCommissionfield.ItalsomakessenseforthepresidentofthecompanytohaveablankManagerfield,sincethatemployeedoesn'treporttoanyone.
Field:
Thesmallestpieceofinformationthatcanberetrievedbythedatabasequerylanguage.Afieldisfoundattheintersectionofarowandacolumninadatabasetable.
Ontheotherhand,noneofthefieldsintheEmployeeNumber(EMPNO)columnareblank.Thecompanyalwayswantstoassignanemployeenumbertoanemployee,andthatnumbermustbedifferentforeachemployee.Oneofthefeaturesofarelationaldatabaseisthatitcanensurethatavalueisenteredintothiscolumnandthatitisunique.TheEMPNOcolumn,inthiscase,istheprimarykeyofthetable.
PrimaryKey:
Acolumn(orcolumns)inatablethatmakestherowinthetabledistinguishablefromeveryotherrowinthesametable.
NoticethedifferentdatatypesthatarestoredintheEMPtable:
numericvalues,characteroralphabeticvalues,anddatevalues.
Asyoumightsuspect,theDEPTNOcolumncontainsthedepartmentnumberfortheemployee.Buthowdoyouknowwhatdepartmentnameisassociatedwithwhatnumber?
ScottcreatedtheDEPTtabletoholdthedescriptionsforthedepartmentcodesintheEMPtable.
TheDEPTNOcolumnintheEMPtablecontainsthesamevaluesastheDEPTNOcolumnintheDEPTtable.Inthiscase,theDEPTNOcolumnintheEMPtableisconsideredaforeignkeytothesamecolumnintheDEPTtable.
Aforeignkeyenforcestheconceptofreferentialintegrityinarelationaldatabase.TheconceptofreferentialintegritynotonlypreventsaninvaliddepartmentnumberfrombeinginsertedintotheEMPtable,butitalsopreventsarowintheDEPTtablefrombeingdeletedifthereareemployeesstillassignedtothatdepartment.
ForeignKey:
Acolumn(orcolumns)inatablethatdrawsitsvaluesfromaprimaryoruniquekeycolumninanothertable.Aforeignkeyassistsinensuringthedataintegrityofatable.ReferentialIntegrityAmethodemployedbyarelationaldatabasesystemthatenforcesone-to-manyrelationshipsbetweentables.
DataModeling
BeforeScottcreatedtheactualtablesinthedatabase,hewentthroughadesignprocessknownasdatamodeling.Inthisprocess,thedeveloperconceptualizesanddocumentsallthetablesforthedatabase.OneofthecommonmethodsformodelingadatabaseiscalledERA,whichstandsforentities,relationships,andattributes.Thedatabasedesignerusesanapplicationthatcanmaintainentities,theirattributes,andtheirrelationships.Ingeneral,anentitycorrespondstoatableinthedatabase,andtheattributesoftheentitycorrespondtocolumnsofthetable.
DataModeling:
Aprocessofdefiningtheentities,attributes,andrelationshipsbetweentheentitiesinpreparationforcreatingthephysicaldatabase.
Thedata-modelingprocessinvolvesdefiningtheentities,definingtherelationshipsbetweenthoseentities,andthendefiningtheattributesforeachoftheentities.Onceacycleiscomplete,itisrepeatedasmanytimesasnecessarytoensurethatthedesigneriscapturingwhatisimportantenoughtogointothedatabase.Let'stakeacloserlookateachstepinthedata-modelingprocess.
DefiningtheEntities
First,thedesigneridentifiesalloftheentitieswithinthescopeofthedatabaseapplication.Theentitiesarethepersons,places,orthingsthatareimportanttotheorganizationandneedtobetrackedinthedatabase.Entitieswillmostlikelytranslateneatlytodatabasetables.Forexample,forthefirstversionofScott'swidgetcompanydatabase,heidentifiesfourentities:
employees,departments,salarygrades,andbonuses.ThesewillbecometheEMP,DEPT,SALGRADE,andBONUStables.
DefiningtheRelationshipsBetweenEntities
Oncetheentitiesaredefined,thedesignercanproceedwithdefininghoweachoftheentitiesisrelated.Often,thedesignerwillpaireachentitywitheveryotherentityandask,"Istherearelationshipbetweenthesetwoentities?
"Somerelationshipsareobvious;somearenot.
Inthewidgetcompanydatabase,thereismostlikelyarelationshipbetweenEMPandDEPT,butdependingonthebusinessrules,itisunlikelythattheDEPTandSALGRADEentitiesarerelated.Ifthebusinessrulesweretorestrictcertainsalarygradestocertaindepartments,therewouldmostlikelybeanewentitythatdefinestherelationshipbetweensalarygradesanddepartments.Thisentitywouldbeknownasanassociativeorintersectiontableandwouldcontainthevalidcombinationsofsalarygradesanddepartments.
AssociativeTable:
Adatabasetablethatstoresthevalidcombinationsofrowsfromtwoothertablesandusuallyenforcesabusinessrule.Anassociativetableresolvesamany-to-manyrelationship.
Ingeneral,therearethreetypesofrelationshipsinarelationaldatabase:
One-to-manyThemostcommontypeofrelationshipisone-to-many.Thismeansthatforeachoccurrenceinagivenentity,theparententity,theremaybeoneormoreoccurrencesinasecondentity,thechildentity,towhichitisrelated.Forexample,inthewidgetcompanydatabase,theDEPTentityisaparententity,andforeachdepartment,therecouldbeoneormoreemployeesassociatedwiththatdepartment.TherelationshipbetweenDEPTandEMPisone-to-many.
One-to-oneInaone-to-onerelationship,arowinatableisrelatedtoonlyoneornoneoftherowsinasecondtable.Thisrelationshiptypeisoftenusedforsubtyping.Forexample,anEMPLOYEEtablemayholdtheinformationcommontoallemployees,whiletheFULLTIME,PARTTIME,andCONTRACTORtablesholdinformationuniquetofull-timeemployees,part-timeemployees,andcontractors,respectively.TheseentitieswouldbeconsideredsubtypesofanEMPLOYEEandmaintainaone-to-onerelationshipwiththeEMPLOYEEtable.Theserelationshipsarenotascommonasone-to-manyrelationships,becauseifoneentityhasanoccurrenceforacorrespondingrowinanotherentity,inmostcases,theattributesfrombothentitiesshouldbeinasingleentity.
Many-to-manyInamany-to-manyrelationship,onerowofatablemayberelatedtomanyrowsofanothertable,andviceversa.Usually,whenthisrelationshipisimplementedinthedatabase,athirdentityisdefinedasanintersectiontabletocontaintheassociationsbetweenthetwoentitiesintherelationship.Forexample,inadatabaseusedforschoolclassenrollment,theSTUDENTtablehasamany-to-manyrelationshipwiththeCLASStable—onestudentmaytake