计算机专业英语6.docx
《计算机专业英语6.docx》由会员分享,可在线阅读,更多相关《计算机专业英语6.docx(7页珍藏版)》请在冰点文库上搜索。
![计算机专业英语6.docx](https://file1.bingdoc.com/fileroot1/2023-6/2/d3baa61b-a14a-4a04-a098-3744fe7c9c33/d3baa61b-a14a-4a04-a098-3744fe7c9c331.gif)
计算机专业英语6
Unit6Database
SectionA
DatabaseOverview
I.Introduction
Datastoragetraditionallyusedindividual,unrelatedfiles,sometimescalledHatfiles.Inthepast,eachapplicationprograminanorganizationuseditsownfile.Inauniversity,forexample,eachdepartmentmighthaveitsownsetoffiles:
therecordofficekeptafileaboutthestudentinformationandtheirgrades,thefinancialaidofficekeptitsownfileaboutstudentsthatneededfinancialaidtocontinuetheireducation,theschedulingofficekeptthenamesoftheprofessorsandthecoursestheywereteaching,thepayrolldepartmentkeptitsownfileaboutthewholestaff(includingprofessors),andsoon.Today,however,alloftheseflatfilescanbecombinedinasingleentity,thedatabaseforthewholeuniversity.
Althoughitisdifficulttogiveauniversallyagreeddefinitionofadatabase,weusethefollowingcommondefinition:
adatabaseisacollectionofrelated,logicallycoherent,datausedbytheapplicationprogramsinanorganization.
II.DatabaseManagementSystems
Adatabasemanagementsystem(DBMS)defines,create,andmaintainsadatabase.TheDBMSalsoallowscontrolledaccesstodatainthedatabase.ADBMSisacombinationoffivecomponents:
hardware,software,data,users,andprocedures.
1.Hardware
Thehardwareisthephysicalcomputersystemthatallowsaccesstodata.Forexample,theterminals,harddisk,maincomputer,andworkstationsareconsideredpartofthehardwareinaDBMS.
2.Software
Thesoftwareistheactualprogramthatallowsuserstoaccess,maintain,andupdatedata.Inaddition,thesoftwarecontrolswhichusercanaccesswhichpartsofthedatainthedatabase.
3.Data
Thedatainadatabaseisstoredphysicallyonthestoragedevice.Inadatabase,dataisaseparateentityfromthesoftwarethataccessesit.Thisseparationallowsanorganizationtochangethesoftwarewithouthavingtochangethephysicaldataorthewayinwhichitisstored.IfanorganizationdecidestouseaDBMS,thenalltheinformationneededbytheorganizationshouldbekepttogetherasoneentity,tobeaccessiblebythesoftwareintheDBMS.
4.Users
ThetermusersinaDBMShasabroadmeaning.Wecandivideusersintotwocategories:
endusersandapplicationprograms.
Endusersarethosehumanswhocanaccessthedatabasedirectlytogetinformation.Therearetwotypesofendusers:
databaseadministrators(DBAs)andnormalusers.DatabaseadministratorshavethemaximumlevelofprivilegesandcancontrolotherusersandtheiraccesstotheDBMS,grantsomeoftheirprivilegestosomebodyelse,butretaintheabilitytorevokethematanytime.Anormaluser,ontheotherhand,canonlyusepartofthedatabaseandhaslimitedaccess.
Theotherusersofdatainadatabaseareapplicationprograms.Applicationsneedtoaccessandprocessdata.Forexample,apayrollapplicationprogramneedstoaccesspartofthedatainadatabasetocreatepaychecksattheendofthemonth.
5.Procedures
ThelastcomponentofaDBMSisasetofproceduresorrulesthatshouldbeclearlydefinedandfollowedbytheusersofthedatabase.
III.DatabaseArchitecture
TheAmericanNationalStandardsInstituteStandardsPlanningandRequirementsCommittee(ANSI/SPARC)hasestablishedathree-levelarchitectureforaDBMS:
internal,conceptual,andexternal(Figure6A-1).
1.InternalLevel
Theinternalleveldetermineswheredataisactuallystoredonthestoragedevices.Thisleveldealswithlow-levelaccessmethodsandhowbytesaretransferredtoandfromstoragedevices.Inotherwords,theinternallevelinteractsdirectlywiththehardware.
2.ConceptualLevel
Theconceptualleveldefinesthelogicalviewofthedata.Thedatamodelisdefinedonthislevel,andthemainfunctionsoftheDBMS,suchasqueries,arealsoonthislevel.TheDBMSchangestheinternalviewofdatatotheexternalviewthatusersneedtosee.Theconceptuallevelisanintermediaryandfreesusersfromdealingwiththeinternallevel.
3.ExternalLevel
Theexternallevelinteractsdirectlywiththeuser(enduserorapplicationprograms).Itchangesthedatacomingfromtheconceptualleveltoaformatandviewthatisfamiliartotheusers.
IV.DatabaseModels
Adatabasemodeldefinesthelogicaldesignofdata.Themodelalsodescribestherelationshipsbetweendifferentpartsofthedata.Inthehistoryofdatabasedesign,threemodelshavebeeninuse:
thehierarchicalmodel,thenetworkmodel,andtherelationalmodel.
1.HierarchicalDatabaseModel
Inthehierarchicalmodel,dataisorganizedasaninvertedtree.Eachentityhasonlyoneparentbutcanhaveseveralchildren.Atthetopofthehierarchy,thereisoneentity,whichiscalledtheroot.Figure6A-2showsalogicalviewofanexampleofthehierarchicalmodel.Thehierarchicalmodelisnowobsolete.
2.NetworkDatabaseModel
Inthenetworkmodel,theentitiesareorganizedinagraph,inwhichsomeentitiescanbeaccessedthroughseveralpaths(Figure6A-3).Thereisnohierarchy.Thismodelisnowalsoobsolete.
3.RelationalDatabaseModel
Intherelationalmodel,dataisorganizedintwo-dimensionaltablescalledrelations.Thereisnohierarchicalornetworkstructureimposedonthedata.Thetablesorrelationsare,however,relatedtoeachother(Figure6A-4).Therelationaldatabasemanagementsystem(RDBMS)organizesthedatasothatitsexternalviewisasetofrelationsortables.Thisdoesnotmeanthatdataisstoredastables:
thephysicalstorageofthedataisindependentofthewayinwhichthedataislogicallyorganized.Figure6A-5showsanexampleofarelation.ArelationinanRDBMShas
thefollowingfeatures:
●Name.Eachrelationinarelationaldatabaseshouldhaveanamethatisuniqueamongotherrelations.
●Attributes.Eachcolumninarelationiscalledanattribute.TheattributesarethecolumnheadingsinthetableinFigure6A-5.Eachattributegivesmeaningtothedatastoredunderit.Eachcolumninthetablemusthaveanamethatisuniqueinthescopeoftherelation.Thetotalnumberofattributesforarelationiscalledthedegreeoftherelation.Forexample,inFigure6A-5,therelationhasadegreeof3.Notethattheattributenamesarenotstoredinthedatabase:
theconceptuallevelusestheattributestogivemeaningtoeachcolumn.
●Tuples.Eachrowinarelationiscalledatuple.Atupledefinesacollectionofattributevalues.Thetotalnumberofrowsinarelationiscalledthecardinalityoftherelation.Notethatthecardinalityofarelationchangeswhentuplesareaddedordeleted.Thismakesthedatabasedynamic.
Therelationalmodelisoneofthecommonmodelsinusetoday.Theothertwocommonmodelsthatarederivedfromtherelationalmodelarethedistributedmodelandtheobject-orientedmodel.
4.DistributedDatabaseMode)
Thedistributeddatabasemodelisnotanewmodel,butisbasedontherelationalmodel.However,thedataisstoredonseveralcomputersthatcommunicatethroughtheInternetoraprivatewideareanetworkEachcomputer(orsite)maintainseitherpartofthedatabaseorthewholedatabase.Inotherwords,dataiseitherfragmented,witheachfragmentstoredatonesite,ordataisreplicatedateachsite.
Inafragmenteddistributeddatabase,dataislocalized—locallyuseddataisstoredatthecorrespondingsite.However,thisdoesnotmeanthatasitecannotaccessdatastoredatanothersite,butaccessismostlylocal,butoccasionallyglobal.Althougheachsitehascompletecontroloveritslocaldata,thereisglobalcontrolthroughtheInternetorawideareanetwork.
Forexample,apharmaceuticalcompanymayhavemultiplesitesinmanycountries.Eachsitehasadatabasewithinformationaboutitsownemployees,butacentralpersonneldepartmentcouldhavecontrolofallthedatabases.
Inareplicateddistributeddatabase,eachsiteholdsanexactreplicaofanothersite.Anymodificationtodatastoredinonesiteisrepeatedexactlyateverysite.Thereasonforhavingsuchadatabaseissecurity.Ifthesystematonesitefails,usersatthesitecanaccessdataatanothersite.
5.Object-OrientedDatabaseModel
Therelationaldatabasehasaspecificviewofdatathatisbasedonthenatureofthedatabase'stuplesandattributes.Thesmallestunitofdatainarelationaldatabaseistheintersectionofatupleandanattribute.However,someapplicationsneedtolookatdataasotherforms,forexa.'dataasastructure,suchasarecordcomposedoffields.
Anobject-orienteddatabasetriestokeeptheadvantagerelationalmodelandatthesametimeallowsapplications|structureddata.Inanobject-orienteddatabase,objectsandtheiraredefined.Inaddition,eachobjectcanhaveattributesthaexpressedasfields.
Forexample,inanorganization,onecoulddefineobject!
employee,department,andcustomer.Theemployeeclasscoulddattributesofanemployeeobject(firstname,lastname,socialnumber,salary,andsoon)andhowtheycanbeaccessed.Thedeobjectcoulddefinetheattributesofthedepartmentandhowthe]accessed.Inaddition,thedatabasecouldcreatearelationbeemployeeobjectandadepartmentobjecttodenotethattheworksinthatdepartment.
V.DatabaseDesign
Thedesignofanydatabaseisalengthyandinvolvedtaskthatabedonethroughastep-by-stepprocess.Thefirststepnormallyinvilotofinterviewingofpotentialusersofthedatabasetocollainformationneededtobestoredandtheaccessrequirementodepartment.Thesecondstepistobuildanentity-relationshipmodel(thatdefinestheentitiesforwhichsomeinformationmustbemaintainattributesoftheseentities,andtherelationshipbetweentheseentities.
Thenextstepindesignisbasedonthetypeofdat