• 1.94 MB
  • 2022-04-29 14:31:50 发布

数据库系统概念全套配套课件PPT ch1.ppt

  • 33页
  • 当前文档由用户上传发布,收益归属用户
  1. 1、本文档共5页,可阅读全部内容。
  2. 2、本文档内容版权归属内容提供方,所产生的收益全部归内容提供方所有。如果您对本文有版权争议,可选择认领,认领后既往收益都归您。
  3. 3、本文档由用户上传,本站不保证质量和数量令人满意,可能有诸多瑕疵,付费之前,请仔细先通过免费阅读内容等途径辨别内容交易风险。如存在严重挂羊头卖狗肉之情形,可联系本站下载客服投诉处理。
  4. 文档侵权举报电话:19940600175。
'Chapter1:Introduction DatabaseManagementSystem(DBMS)DBMScontainsinformationaboutaparticularenterpriseCollectionofinterrelateddataSetofprogramstoaccessthedataAnenvironmentthatisbothconvenientandefficienttouseDatabaseApplications:Banking:transactionsAirlines:reservations,schedulesUniversities:registration,gradesSales:customers,products,purchasesOnlineretailers:ordertracking,customizedrecommendationsManufacturing:production,inventory,orders,supplychainHumanresources:employeerecords,salaries,taxdeductionsDatabasescanbeverylarge.Databasestouchallaspectsofourlives UniversityDatabaseExampleApplicationprogramexamplesAddnewstudents,instructors,andcoursesRegisterstudentsforcourses,andgenerateclassrostersAssigngradestostudents,computegradepointaverages(GPA)andgeneratetranscriptsIntheearlydays,databaseapplicationswerebuiltdirectlyontopoffilesystems DrawbacksofusingfilesystemstostoredataDataredundancyandinconsistencyMultiplefileformats,duplicationofinformationindifferentfilesDifficultyinaccessingdataNeedtowriteanewprogramtocarryouteachnewtaskDataisolation—multiplefilesandformatsIntegrityproblemsIntegrityconstraints(e.g.,accountbalance>0)become“buried”inprogramcoderatherthanbeingstatedexplicitlyHardtoaddnewconstraintsorchangeexistingones Drawbacksofusingfilesystemstostoredata(Cont.)AtomicityofupdatesFailuresmayleavedatabaseinaninconsistentstatewithpartialupdatescarriedoutExample:TransferoffundsfromoneaccounttoanothershouldeithercompleteornothappenatallConcurrentaccessbymultipleusersConcurrentaccessneededforperformanceUncontrolledconcurrentaccessescanleadtoinconsistenciesExample:Twopeoplereadingabalance(say100)andupdatingitbywithdrawingmoney(say50each)atthesametimeSecurityproblemsHardtoprovideuseraccesstosome,butnotall,dataDatabasesystemsoffersolutionstoalltheaboveproblems LevelsofAbstractionPhysicallevel:describeshowarecord(e.g.,customer)isstored.Logicallevel:describesdatastoredindatabase,andtherelationshipsamongthedata.typeinstructor=recordID:string;name:string;dept_name:string;salary:integer;end;Viewlevel:applicationprogramshidedetailsofdatatypes.Viewscanalsohideinformation(suchasanemployee’ssalary)forsecuritypurposes. ViewofDataAnarchitectureforadatabasesystem InstancesandSchemasSimilartotypesandvariablesinprogramminglanguagesSchema–thelogicalstructureofthedatabaseExample:ThedatabaseconsistsofinformationaboutasetofcustomersandaccountsandtherelationshipbetweenthemAnalogoustotypeinformationofavariableinaprogramPhysicalschema:databasedesignatthephysicallevelLogicalschema:databasedesignatthelogicallevelInstance–theactualcontentofthedatabaseataparticularpointintimeAnalogoustothevalueofavariablePhysicalDataIndependence–theabilitytomodifythephysicalschemawithoutchangingthelogicalschemaApplicationsdependonthelogicalschemaIngeneral,theinterfacesbetweenthevariouslevelsandcomponentsshouldbewelldefinedsothatchangesinsomepartsdonotseriouslyinfluenceothers. DataModelsAcollectionoftoolsfordescribingDataDatarelationshipsDatasemanticsDataconstraintsRelationalmodelEntity-Relationshipdatamodel(mainlyfordatabasedesign)Object-baseddatamodels(Object-orientedandObject-relational)Semistructureddatamodel(XML)Otheroldermodels:NetworkmodelHierarchicalmodel RelationalModelRelationalmodel(Chapter2)ExampleoftabulardataintherelationalmodelColumnsRows ASampleRelationalDatabase DataManipulationLanguage(DML)LanguageforaccessingandmanipulatingthedataorganizedbytheappropriatedatamodelDMLalsoknownasquerylanguageTwoclassesoflanguagesProcedural–userspecifieswhatdataisrequiredandhowtogetthosedataDeclarative(nonprocedural)–userspecifieswhatdataisrequiredwithoutspecifyinghowtogetthosedataSQListhemostwidelyusedquerylanguage DataDefinitionLanguage(DDL)SpecificationnotationfordefiningthedatabaseschemaExample:createtableinstructor(IDchar(5),namevarchar(20),dept_namevarchar(20),salarynumeric(8,2))DDLcompilergeneratesasetoftabletemplatesstoredinadatadictionaryDatadictionarycontainsmetadata(i.e.,dataaboutdata)DatabaseschemaIntegrityconstraintsPrimarykey(IDuniquelyidentifiesinstructors)Referentialintegrity(referencesconstraintinSQL)e.g.dept_namevalueinanyinstructortuplemustappearindepartmentrelationAuthorization SQLSQL:widelyusednon-procedurallanguageExample:FindthenameoftheinstructorwithID22222selectnamefrominstructorwhereinstructor.ID=‘22222’Example:FindtheIDandbuildingofinstructorsinthePhysicsdept.selectinstructor.ID,department.buildingfrominstructor,departmentwhereinstructor.dept_name=department.dept_nameanddepartment.dept_name=‘Physics’ApplicationprogramsgenerallyaccessdatabasesthroughoneofLanguageextensionstoallowembeddedSQLApplicationprograminterface(e.g.,ODBC/JDBC)whichallowSQLqueriestobesenttoadatabaseChapters3,4and5 DatabaseDesignTheprocessofdesigningthegeneralstructureofthedatabase:LogicalDesign–Decidingonthedatabaseschema.Databasedesignrequiresthatwefinda“good”collectionofrelationschemas.Businessdecision–Whatattributesshouldwerecordinthedatabase?ComputerSciencedecision–Whatrelationschemasshouldwehaveandhowshouldtheattributesbedistributedamongthevariousrelationschemas?PhysicalDesign–Decidingonthephysicallayoutofthedatabase DatabaseDesign?Isthereanyproblemwiththisdesign? DesignApproachesNormalizationTheory(Chapter8)Formalizewhatdesignsarebad,andtestforthemEntityRelationshipModel(Chapter7)ModelsanenterpriseasacollectionofentitiesandrelationshipsEntity:a“thing”or“object”intheenterprisethatisdistinguishablefromotherobjectsDescribedbyasetofattributesRelationship:anassociationamongseveralentitiesRepresenteddiagrammaticallybyanentity-relationshipdiagram: TheEntity-RelationshipModelModelsanenterpriseasacollectionofentitiesandrelationshipsEntity:a“thing”or“object”intheenterprisethatisdistinguishablefromotherobjectsDescribedbyasetofattributesRelationship:anassociationamongseveralentitiesRepresenteddiagrammaticallybyanentity-relationshipdiagram:Whathappenedtodept_nameofinstructorandstudent? Object-RelationalDataModelsRelationalmodel:flat,“atomic”valuesObjectRelationalDataModelsExtendtherelationaldatamodelbyincludingobjectorientationandconstructstodealwithaddeddatatypes.Allowattributesoftuplestohavecomplextypes,includingnon-atomicvaluessuchasnestedrelations.Preserverelationalfoundations,inparticularthedeclarativeaccesstodata,whileextendingmodelingpower.Provideupwardcompatibilitywithexistingrelationallanguages. XML:ExtensibleMarkupLanguageDefinedbytheWWWConsortium(W3C)OriginallyintendedasadocumentmarkuplanguagenotadatabaselanguageTheabilitytospecifynewtags,andtocreatenestedtagstructuresmadeXMLagreatwaytoexchangedata,notjustdocumentsXMLhasbecomethebasisforallnewgenerationdatainterchangeformats.Awidevarietyoftoolsisavailableforparsing,browsingandqueryingXMLdocuments/data StorageManagementStoragemanagerisaprogrammodulethatprovidestheinterfacebetweenthelow-leveldatastoredinthedatabaseandtheapplicationprogramsandqueriessubmittedtothesystem.Thestoragemanagerisresponsibletothefollowingtasks:InteractionwiththefilemanagerEfficientstoring,retrievingandupdatingofdataIssues:StorageaccessFileorganizationIndexingandhashing QueryProcessing1.Parsingandtranslation2.Optimization3.Evaluation QueryProcessing(Cont.)AlternativewaysofevaluatingagivenqueryEquivalentexpressionsDifferentalgorithmsforeachoperationCostdifferencebetweenagoodandabadwayofevaluatingaquerycanbeenormousNeedtoestimatethecostofoperationsDependscriticallyonstatisticalinformationaboutrelationswhichthedatabasemustmaintainNeedtoestimatestatisticsforintermediateresultstocomputecostofcomplexexpressions TransactionManagementWhatifthesystemfails?Whatifmorethanoneuserisconcurrentlyupdatingthesamedata?AtransactionisacollectionofoperationsthatperformsasinglelogicalfunctioninadatabaseapplicationTransaction-managementcomponentensuresthatthedatabaseremainsinaconsistent(correct)statedespitesystemfailures(e.g.,powerfailuresandoperatingsystemcrashes)andtransactionfailures.Concurrency-controlmanagercontrolstheinteractionamongtheconcurrenttransactions,toensuretheconsistencyofthedatabase. DatabaseUsersandAdministratorsDatabase DatabaseSystemInternals DatabaseArchitectureThearchitectureofadatabasesystemsisgreatlyinfluencedbytheunderlyingcomputersystemonwhichthedatabaseisrunning:CentralizedClient-serverParallel(multi-processor)Distributed HistoryofDatabaseSystems1950sandearly1960s:DataprocessingusingmagnetictapesforstorageTapesprovidedonlysequentialaccessPunchedcardsforinputLate1960sand1970s:HarddisksalloweddirectaccesstodataNetworkandhierarchicaldatamodelsinwidespreaduseTedCodddefinestherelationaldatamodelWouldwintheACMTuringAwardforthisworkIBMResearchbeginsSystemRprototypeUCBerkeleybeginsIngresprototypeHigh-performance(fortheera)transactionprocessing History(cont.)1980s:ResearchrelationalprototypesevolveintocommercialsystemsSQLbecomesindustrialstandardParallelanddistributeddatabasesystemsObject-orienteddatabasesystems1990s:Largedecisionsupportanddata-miningapplicationsLargemulti-terabytedatawarehousesEmergenceofWebcommerceEarly2000s:XMLandXQuerystandardsAutomateddatabaseadministrationLater2000s:GiantdatastoragesystemsGoogleBigTable,YahooPNuts,Amazon,.. EndofChapter1 Figure1.02 Figure1.04 Figure1.06'