




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
应用层协议及其安全实践第一页,共一百一十四页,2022年,8月28日WhyStudyDatabases??Shiftfromcomputationtoinformationatthe“lowend”:scrambletowebspace(amess!)atthe“highend”:scientificapplicationsDatasetsincreasingindiversityandvolume.Digitallibraries,interactivevideo,HumanGenomeproject,EOSproject...needforDBMSexplodingDBMSencompassesmostofCSOS,languages,theory,“AI”,multimedia,logic?ScienceComputingProcessingControlDataProcessing(70%)第二页,共一百一十四页,2022年,8月28日WhyStudyDBMS?WeoftenuseDBMS…….. Banking:alltransactionsAirlines:reservations,schedulesUniversities:registration,gradesSales:customers,products,purchasesOnlineretailers:ordertracking,customizedrecommendationsManufacturing:production,inventory,orders,supplychainHumanresources:employeerecords,salaries,taxdeductions
ButDBMSjustlikeablackbox.TrytoopentheblackboxDatabasefilesystem/pages/records/bytes/bitsPrinciplesofDBMSandimplementtechnologiesLearnmoreaboutDBMS第三页,共一百一十四页,2022年,8月28日MoreopportunitiesinthejobmarketCareerdevelopmentComputerskillsBenefitsfor…第四页,共一百一十四页,2022年,8月28日5TextBooksandReferencesRaghuRamakrishnan,DatabaseManagementSystems,McGrawHill,3rdedition,2003(textbook).R.Elmasri,S.B.Navathe,FundamentalsofDatabaseSystems,4thedition,Addison-Wesley,2004.A.Silberschatz,H.F.Korth,S.Sudarshan,DatabaseSystemConcepts,McGrawHill,4thedition,2002.萨师煊,王珊:数据库系统概论(第四版),高等教育出版社,2000.中国人民大学周立柱、冯建华等《SQLServer数据库原理--设计与实现》第五页,共一百一十四页,2022年,8月28日采用直观的方式描述所有概念,并以结构清晰的图示和例子代替形式化的证明。以银行数据库实例生动地解释重要概念,增强了本书的易读性。专门用三章来介绍特定的商品化数据库系统Oracle、MicrosoftSQLServer和IBMDB2的细节。配有关于网状模型和层次模型的联机附录(英文)。第六页,共一百一十四页,2022年,8月28日1950,负责全校经济和管理类公共数学课的教学工作,文科数学。83年,与王珊第一版数据库泰斗多次奖项多次规划教材使用学生众多第七页,共一百一十四页,2022年,8月28日8CourseOutlineIntroductiontoDatabaseManagementSystemsEntity-RelationshipModelTheRelationalDataModelRelationalAlgebraSQLRelationalDatabaseDesign:NormalizationMSSQLserver第八页,共一百一十四页,2022年,8月28日9GradingAssignments 10%Experiments 40%FinalExam 60%
第九页,共一百一十四页,2022年,8月28日Howtolearnwell?网络资源精品课程网络视频第十页,共一百一十四页,2022年,8月28日IntroductiontoDBMSWhatIsaDBMS?WhatAboutDBMSHistory?WhyUseDBMS?FunctionsofDBMS?DBMSArchitecture?第十一页,共一百一十四页,2022年,8月28日WhatIsaDBMS?Data(数据)Database(数据库)DBMS(数据库管理系统)DBS(数据库系统)第十二页,共一百一十四页,2022年,8月28日DataTherepresentativeformsofinformation,includingfacts,concepts,rules,oranyotherkindofknowledge.numbers,characters,imagesorothermethodsofrecording.representvaluesthatcanbestored,processed,andtransmittedbyelectronicsystems,especiallythecomputer.第十三页,共一百一十四页,2022年,8月28日Datainstance学生档案中的学生记录(李明,男,1972,江苏,计算机系,1990)数据的解释语义:学生姓名、性别、出生年月、籍贯、所在系别、入学时间解释:李明是个大学生,1972年出生,江苏人,1990年考入计算机系数据的形式不能完全表达其内容第十四页,共一百一十四页,2022年,8月28日DatabaseAverylarge,integratedcollectionofdatastoredinthecomputer.LowreductdanceShareabilityDataindependenceIntegritymanagementandcontrol第十五页,共一百一十四页,2022年,8月28日Averylarge,integratedcollectionofdatastoredinthecomputerModelsreal-worldenterprise.Entities(e.g.,students,courses)Relationships(e.g.,TarkanistakingCENG302)ADatabaseManagementSystem(DBMS)
isasoftwarepackagedesignedtostoreandmanagedatabases.DatabaseManagementSystem(DBMS)第十六页,共一百一十四页,2022年,8月28日OracleSQLserverSybaseMysqlDB2INFORMIXVFPDatabasemanagementsystemexamples第十七页,共一百一十四页,2022年,8月28日DataDefinitionDDL,DataDefinitionLanguageDataManipulationDML,DataManipulationLanguageOperationManagementSetupandMaintainDBMSFUNCTION第十八页,共一百一十四页,2022年,8月28日ProvideUserInterfaceProvideDataManipulationLanguageProvideDataDefinitionLanguageProvidesometoolsManagedatabaseMaintaindatabaseDBMSFUNCTION(continue)第十九页,共一百一十四页,2022年,8月28日C,VC,C++VBPOWERBUILDERDELPHIJAVAASP/JSPODBC/JDBCDatabaselanguage(DDL,DML)Developmenttoolkits/language第二十页,共一百一十四页,2022年,8月28日开放数据库互连(ODBC)是MICROSOFT提出的数据库访问接口标准。开放数据库互连定义了访问数据库的API一个规范,这些API独立于不同厂商的DBMS,也独立于具体的编程语言。OpenDatabaseConnectOracleSqlserversybaseaccessODBCAPIODBC驱动C++VBPBJAVA第二十一页,共一百一十四页,2022年,8月28日JavaDatabaseConnect(JDBC)Java数据库连接,(JavaDatabaseConnectivity,简称JDBC)是Java语言中用来规范客户端程序如何来访问数据库的应用程序接口,提供了诸如查询和更新数据库中数据的方法。JDBC也是SunMicrosystems的商标。它JDBC是面向关系型数据库的。第二十二页,共一百一十四页,2022年,8月28日硬件操作系统DBMS应用开发工具应用系统第二十三页,共一百一十四页,2022年,8月28日DatabaseManagementSystem(DBMS)DBMScontainsinformationaboutaparticularenterpriseCollectionofinterrelateddata--DatabaseSetofprogramstoaccessthedataAnenvironmentthatisbothconvenientandefficienttouseDatabaseapplicationsBanking:alltransactionsAirlines:reservations,schedulesUniversities:registration,gradesSales:customers,products,purchasesOnlineretailers:ordertracking,customizedrecommendationsManufacturing:production,inventory,orders,supplychainHumanresources:employeerecords,salaries,taxdeductions
Databasestouchallaspectsofourlives第二十四页,共一百一十四页,2022年,8月28日DatabaseOperationsystemDBMSApplicationsystemDBAUsersDatabaseSystem(DBS)数据库系统一般由数据库、操作系统、数据库管理系统(及其开发工具)、应用系统、数据库管理员(DBA)和用户构成。第二十五页,共一百一十四页,2022年,8月28日USERUSERUSERApplicationDBMSOSDBDBA用户用户用户应用系统数据库管理员DevelopmentToolskits开发工具Databasesystem第二十六页,共一百一十四页,2022年,8月28日DatabasesystemArchitecture
Thearchitectureofadatabasesystemsisgreatlyinfluencedbytheunderlyingcomputersystemonwhichthedatabaseisrunning:CentralizedClient-serverParallel(multi-processor)Distributed
Browser/Server第二十七页,共一百一十四页,2022年,8月28日Centralized(集中式系统)
DBMS和应用程序以及与用户终端进行通信的软件等都运行在一台宿主计算机上,所有的数据处理都是在宿主计算机中进行。宿主计算机一般是大型机、中型机或小型机。应用程序和DBMS之间通过操作系统管理的共享内存或应用任务区来进行通信,DBMS利用操作系统提供的服务来访问数据库。终端通常是非智能的,本身没有处理能力。集中系统的主要优点是:具有集中的安全控制,以及处理大量数据和支持大量并发用户的能力。集中系统的主要缺点是:购买和维持这样的系统一次性投资太大,并且不适合分布处理。PC(个人计算机系统)
与大型系统不同,通常个人计算机(微机)上的DBMS功能和数据库应用功能是结合在一个应用程序中的,这类DBMS(如FoxPro、Acssce)的功能灵活,系统结构简洁,运行速度快,但这类DBMS的数据共享性、安全性、完整性等控制功能比较薄弱。第二十八页,共一百一十四页,2022年,8月28日在客户/服务器(简记为C/S)结构的数据库系统中,数据处理任务被划分为两部分:一部分运行在客户端,另一部分运行在服务器端。客户端负责应用处理,数据库服务器完成DBMS的核心功能。这种模型中,客户机上都必须安装应用程序和工具,客户端比较庞大、负担比较重,而且系统安装、维护、升级和发布困难,从而影响效率。
Client-server(客户/服务器系统)第二十九页,共一百一十四页,2022年,8月28日一个分布式数据系统由一个逻辑数据库组成,整个逻辑数据库的数据,存储在分布于网络中的多个结点上的物理数据库中。在当今的客户/服务器结构的数据库系统中,服务器的数目可以是一个或多个。当系统中存在多个数据库服务器时就形成了分布系统。Distributed(分布式系统)第三十页,共一百一十四页,2022年,8月28日Distributedsystem第三十一页,共一百一十四页,2022年,8月28日随着Internet的迅速普及,出现了三层客户机/服务器模型:客户机→应用服务器→数据库服务器。这种系统称为浏览器/服务器(Browser/Server,简记为B/S)系统。Browser/Server(浏览器/服务器系统)第三十二页,共一百一十四页,2022年,8月28日WhyWeNeedaDBMS?theincreasingofthegreatnumberofinformationresourcesKB,MB,GB,TB,PB,EB,ZB,YBTraditionaldatamanagementtechnologycannotmeettheincreasingneedsMassivebenefitsthroughdataanalysisandprocessingWeatherforecastairspaceBankandstocksmarketDBMSisthebestwaytosolvetheabovequestions第三十三页,共一百一十四页,2022年,8月28日WhyUseaDBMS?Dataindependenceandefficientaccess.(数据独立性和高效访问)Reducedapplicationdevelopmenttime.(减少应用程序开发时间)Dataintegrityandsecurity.(数据完整性和安全性)Uniformdataadministration.(统一的数据管理)Concurrentaccess,recoveryfromcrashes.(并发控制和灾难恢复)第三十四页,共一百一十四页,2022年,8月28日DatamanagementhistoryDatamanagementthecontrolofdatahandlingoperations--suchasacquisition,analysis,translation,coding,storage,retrieval,anddistributionofdata
Development
Manualmanagement(1940s—mid1950s)Filesystemmanagement(1950s—mid1960s)Databasemanagement(1960s--)第三十五页,共一百一十四页,2022年,8月28日Manualmanagement1940s-1950sFocusonscientificcomputingHardware nodirectaccessstoragedeviceSoftwaresystemnooperationsystem Dataprocessingbatchprocessing 第三十六页,共一百一十四页,2022年,8月28日Filemanagement1950sandearly1960s:DataprocessingusingmagnetictapesforstorageTapesprovideonlysequentialaccessPunchedcardsforinput1960sFilesystem(Intheearlydays,databaseapplicationswerebuiltdirectlyontopoffilesystems)Demand
scientificmanagementHardware
disk、diskdrum
Softwarefilesystem
ProcessingOLAP、batchprocessing第三十七页,共一百一十四页,2022年,8月28日DrawbacksofusingfilesystemsDrawbacksofusingfilesystemstostoredata:DataredundancyandinconsistencyMultiplefileformats,duplicationofinformationindifferentfilesDifficultyinaccessingdataNeedtowriteanewprogramtocarryouteachnewtaskDataisolation—multiplefilesandformatsIntegrityproblemsIntegrityconstraints(e.g.accountbalance>0)become“buried”inprogramcoderatherthanbeingstatedexplicitlyHardtoaddnewconstraintsorchangeexistingones第三十八页,共一百一十四页,2022年,8月28日Drawbacksofusingfilesystems(Cont.)AtomicityofupdatesFailuresmayleavedatabaseinaninconsistentstatewithpartialupdatescarriedoutExample:TransferoffundsfromoneaccounttoanothershouldeithercompleteornothappenatallConcurrentaccessbymultipleusersConcurrentaccessedneededforperformanceUncontrolledconcurrentaccessescanleadtoinconsistenciesExample:TwopeoplereadingabalanceandupdatingitatthesametimeSecurityproblemsHardtoprovideuseraccesstosome,butnotall,dataDatabasesystemsoffersolutionstoalltheaboveproblems第三十九页,共一百一十四页,2022年,8月28日HistoryofDatabaseSystemsLate1960sand1970s:HarddisksallowdirectaccesstodataNetworkandhierarchicaldatamodelsinwidespreaduseTedCodddefinestherelationaldatamodelWouldwintheACMTuringAwardforthisworkIBMResearchbeginsSystemRprototypeUCBerkeleybeginsIngresprototypeHigh-performance(fortheera)transactionprocessing第四十页,共一百一十四页,2022年,8月28日History(cont.)1980s:ResearchrelationalprototypesevolveintocommercialsystemsSQLbecomesindustrialstandardParallelanddistributeddatabasesystemsObject-orienteddatabasesystems1990s:Largedecisionsupportanddata-miningapplicationsLargemulti-terabytedatawarehousesEmergenceofWebcommerce2000s:XMLandXQuerystandardsAutomateddatabaseadministration第四十一页,共一百一十四页,2022年,8月28日Database-AdvantagesReduceddataredundancy(冗余)Reducedupdatingerrorsandincreasedconsistency(一致性)Greaterdataintegrityandindependencefromapplicationsprograms(完整性和独立性)Improveddataaccesstousersthroughuseofhostandquerylanguages(访问能力)Improveddatasecurity(数据安全)Reduceddataentry,storage,andretrievalcosts(减少数据存取开销)Facilitateddevelopmentofnewapplicationsprogram(为开发新程序提供便利第四十二页,共一百一十四页,2022年,8月28日SummaryDBMS-howcometodayDemanddrivenbyapplicationrequirementsSoftwaredevelopmentHardwaredevelopment第四十三页,共一百一十四页,2022年,8月28日1、试述数据、数据库、数据库管理系统、数据库系统的概念;2、使用数据库有什么好处?3、试述文件系统和数据库系统的区别与联系。4、名词解释:数据定义语言;数据操纵语言。5、试述数据库系统的功能。6、以图书馆管理系统为例,试述开发一个数据库应用程序的大致步骤。Assignment第四十四页,共一百一十四页,2022年,8月28日概念模型和三级模式结构第四十五页,共一百一十四页,2022年,8月28日shiftfromtherealworldtoConceptschema客观对象的抽象过程两步抽象现实世界中的客观对象抽象为概念模型;把概念模型转换为某一DBMS支持的数据模型。概念模型是现实世界到机器世界的一个中间层次。
数据库中用数据模型来抽象、表示和处理现实世界中的数据。第四十六页,共一百一十四页,2022年,8月28日DBMSArchitecturedataUserviewComputerviewDBMS-schemaanddatamodelshiftfromtherealworldtodigitalworld第四十七页,共一百一十四页,2022年,8月28日Conceptschema概念模型的用途概念模型用于信息世界的建模是现实世界到机器世界的一个中间层次是数据库设计的有力工具数据库设计人员和用户之间进行交流的语言对概念模型的基本要求较强的语义表达能力,能够方便、直接地表达应用中的各种语义知识简单、清晰、易于用户理解。第四十八页,共一百一十四页,2022年,8月28日redundantandinconsistentflexibilitymultipledatabases第四十九页,共一百一十四页,2022年,8月28日SchemasExternalschemaforuserviewsdefinestheviewofthedatapresentedtothe applicationprogramsConceptualschemaintegratesexternalschematathelogicalstructureofthedatabaseTheprimaryobjectiveofthisconceptualschemaistoprovideaconsistentdefinitionofthemeaningsandinterrelationshipofdatawhichcanbeusedtointegrate,share,andmanagetheintegrityofdata.Internalschemathatdefinesphysicalstoragestructuresdescribestheinternalformatsofthedatastoredinthedatabase第五十页,共一百一十四页,2022年,8月28日AdvantageofThreeSchemaslayeredarchitecture第五十一页,共一百一十四页,2022年,8月28日ViewofDataAnarchitectureforadatabasesystem第五十二页,共一百一十四页,2022年,8月28日DataIndependenceApplicationsinsulatedfromhowdataisstructuredandstored.Logicaldataindependence:Protectionfromchangesinlogicalstructureofdata.Physicaldataindependence:Protectionfromchangesinphysicalstructureofdata.
OneofthemostimportantbenefitsofusingaDBMS!第五十三页,共一百一十四页,2022年,8月28日LevelsofAbstractionManyexternalschemata,singleconceptual(logical)
schema
andphysicalschema.Externalschematadescribehowusersseethedata.ConceptualschemadefineslogicalstructurePhysicalschemadescribesthefilesandindexesused.
SchemasaredefinedusingDDL;dataismodified/queriedusingDML.PhysicalSchemaConceptualSchemaExternalSchema1ExternalSchema3ExternalSchema2第五十四页,共一百一十四页,2022年,8月28日LevelsofAbstractionAmajorpurposeofadatabasesystemistoprovideuserswithanabstractviewofthedata.Thesystemhidescertaindetailsofhowthedataarestoredandmaintained.Physicallevel:describeshowarecord(e.g.,customer)isstored.Logicallevel:describeswhatdataarestoredindatabase,andtherelationshipsamongthedata. typecustomer=record
customer_id:string;
customer_name:string;
customer_street:string;
customer_city:integer;end;Viewlevel:applicationprogramshidedetailsofdatatypes.Viewscanalsohideinformation(suchasanemployee’ssalary)forsecuritypurposes.第五十五页,共一百一十四页,2022年,8月28日InstancesandSchemasSimilartotypesandvariablesinprogramminglanguagesSchema–thelogicalstructureofthedatabaseExample:ThedatabaseconsistsofinformationaboutasetofcustomersandaccountsandtherelationshipbetweenthemAnalogoustotypeinformationofavariableinaprogramPhysicalschema:databasedesignatthephysicallevelLogicalschema:databasedesignatthelogicallevelInstance–theactualcontentofthedatabaseataparticularpointintimeAnalogoustothevalueofavariablePhysicalDataIndependence–theabilitytomodifythephysicalschemawithoutchangingthelogicalschemaApplicationsdependonthelogicalschemaIngeneral,theinterfacesbetweenthevariouslevelsandcomponentsshouldbewelldefinedsothatchangesinsomepartsdonotseriouslyinfluenceothers.第五十六页,共一百一十四页,2022年,8月28日StructureofaDBMSAtypicalDBMShasalayeredarchitecture.Thisisoneofseveralpossiblearchitectures;eachsystemhasitsownvariations.QueryOptimizationandExecutionRelationalOperatorsFilesandAccessMethodsBufferManagementDiskSpaceManagementDBTheselayersmustconsiderconcurrencycontrolandrecovery第五十七页,共一百一十四页,2022年,8月28日StructureofaDBMS第五十八页,共一百一十四页,2022年,8月28日Howdataisorganizedinthedatabase?DataModels第五十九页,共一百一十四页,2022年,8月28日DataModelsAdatamodel
isacollectionofconceptsfordescribingdata.Aschema
isadescriptionofaparticularcollectionofdata,usingthegivendatamodel.requirement能比较真实地模拟现实世界容易为人所理解便于在计算机上实现Therelationalmodelofdata
isthemostwidelyusedmodeltoday.Mainconcept:
relation,basicallyatablewithrowsandcolumns.Everyrelationhasaschema,whichdescribesthecolumns,orfields.第六十页,共一百一十四页,2022年,8月28日DataModelsTypeEntity-Relationshipdatamodel(mainlyfordatabasedesign)RelationalmodelObject-baseddatamodels(Object-orientedandObject-relational)Semistructureddatamodel(XML)Otheroldermodels:NetworkmodelHierarchicalmodel第六十一页,共一百一十四页,2022年,8月28日SummaryConceptmodelExternalschemaConceptschemaInternalschemaDatamodelRelationalmodel第六十二页,共一百一十四页,2022年,8月28日Conceptschema概念模型的用途概念模型用于信息世界的建模是现实世界到机器世界的一个中间层次是数据库设计的有力工具数据库设计人员和用户之间进行交流的语言对概念模型的基本要求较强的语义表达能力,能够方便、直接地表达应用中的各种语义知识简单、清晰、易于用户理解。第六十三页,共一百一十四页,2022年,8月28日definitions实体(Entity)“thing”orobject属性(Attribute)Propertyof(theentitiesof)anentityset.Attributesaresimplevalues,egersorcharacterstrings.实体型(EntityType)aclassofentitieswiththesameattributes实体集(EntitySet)同型实体的集合称为实体集第六十四页,共一百一十四页,2022年,8月28日ExampleEntitysetBeershastwoattributes,nameandmanf(manufacturer).EachBeersentityhasvaluesforthesetwoattributes,e.g.(Bud,Anheuser-Busch)Beersnamemanf第六十五页,共一百一十四页,2022年,8月28日definitions(conti.)码(Key)唯一标识实体的属性集称为码。域(Domain)属性的取值范围称为该属性的域。第六十六页,共一百一十四页,2022年,8月28日definitions(conti.)联系(Relationship)
anassociationbetweentwoormoreentitiesthatisofparticularinterest现实世界中事物内部以及事物之间的联系在信息世界中反映为实体内部的联系和实体之间的联系。实体型间联系两个实体型一对一联系(1:1)三个实体型一对多联系(1:n)一个实体型多对多联系(m:n)
第六十七页,共一百一十四页,2022年,8月28日两个实体型间的联系一对一联系如果对于实体集A中的每一个实体,实体集B中至多有一个实体与之联系,反之亦然,则称实体集A与实体集B具有一对一联系。记为1:1。
实例班级与班长之间的联系:一个班级只有一个正班长一个班长只在一个班中任职第六十八页,共一百一十四页,2022年,8月28日两个实体型间的联系(续)一对多联系如果对于实体集A中的每一个实体,实体集B中有n个实体(n≥0)与之联系,反之,对于实体集B中的每一个实体,实体集A中至多只有一个实体与之联系,则称实体集A与实体集B有一对多联系记为1:n实例班级与学生之间的联系:一个班级中有若干名学生,每个学生只在一个班级中学习第六十九页,共一百一十四页,2022年,8月28日两个实体型间的联系(续)多对多联系(m:n)如果对于实体集A中的每一个实体,实体集B中有n个实体(n≥0)与之联系,反之,对于实体集B中的每一个实体,实体集A中也有m个实体(m≥0)与之联系,则称实体集A与实体B具有多对多联系。记为m:n实例课程与学生之间的联系:一门课程同时有若干个学生选修一个学生可以同时选修多门课程第七十页,共一百一十四页,2022年,8月28日多个实体型间的联系(续)多个实体型间的一对多联系若实体集E1,E2,...,En存在联系,对于实体集Ej(j=1,2,...,i-1,i+1,...,n)中的给定实体,最多只和Ei中的一个实体相联系,则我们说Ei与E1,E2,...,Ei-1,Ei+1,...,En之间的联系是一对多的。第七十一页,共一百一十四页,2022年,8月28日多个实体型间的联系(续)实例
课程、教师与参考书三个实体型如果一门课程可以有若干个教师讲授,使用若干本参考书,每一个教师只讲授一门课程,每一本参考书只供一门课程使用课程与教师、参考书之间的联系是一对多的多个实体型间的一对一联系多个实体型间的多对多联系第七十二页,共一百一十四页,2022年,8月28日DegreesofrelationshipManWomanCustomerOrderCourseSubjectOne-to-one(1:1)One-to-many(1:n)Many-to-many(n:m)NOTE:Everymanytomanyrelationshipconsistsoftwoonetomanyrelationshipsworkinginoppositedirections第七十三页,共一百一十四页,2022年,8月28日概念模型的表示方法概念模型的表示方法很多实体-联系方法(E-R方法)用E-R图来描述现实世界的概念模型E-R方法也称为E-R模型第七十四页,共一百一十四页,2022年,8月28日WhyuseERDiagrams?
providesaglobalquickreferencetoanorganization’sdatastructures.canbeusedindividuallytodesignanInformationSystem’s(IS)datastructurecanbeusedwithDataFlowDiagramstoprovideamorecomprehensiveISlogicaldesign.第七十五页,共一百一十四页,2022年,8月28日ERDDevelopmentProcessIdentifytheentitiesDeterminetheattributesforeachentitySelecttheprimarykeyforeachentityEstablishtherelationshipsbetweentheentitiesDrawanentitymodelTesttherelationshipsandthekeys第七十六页,共一百一十四页,2022年,8月28日Identifytheentities实体型用矩形表示,矩形框内写明实体名。Entityset=rectangle.学生教师第七十七页,共一百一十四页,2022年,8月28日Determinetheattributesforeachentity属性用椭圆形表示,并用无向边将其与相应的实体连接起来Attribute=oval,withalinetotherectanglerepresentingitsentityset.学生学号年龄性别姓名第七十八页,共一百一十四页,2022年,8月28日KeyAttributesCertainattributesidentifyparticularfactswithinanentity,theseareknownasKEYattributes.ThedifferenttypesofKEYattributeare:PrimaryKeyCompositePrimaryKeyForeignKey第七十九页,共一百一十四页,2022年,8月28日KeyDefinitionsPrimaryKey:Oneattributewhosevaluecanuniquelyidentifyacompleterecord(onerowofdata)withinanentity.CompositePrimaryKeyAprimarykeythatconsistsoftwoormoreattributewithinanentity.ForeignKeyAcopyofaprimarykeythatexistsinanotherentityforthepurposeofformingarelationshipbetweentheentitiesinvolved.第八十页,共一百一十四页,2022年,8月28日EstablishtherelationshipsbetweentheentitiesArelationshipconnectstwoormoreentitysets.Itisrepresentedbyadiamond,withlinestoeachoftheentitysetsinvolved.第八十一页,共一百一十四页,2022年,8月28日E-R图(续)联系联系本身:用菱形表示,菱形框内写明联系名,并用无向边分别与有关实体连接起来,同时在无向边旁标上联系的类型(1:1、1:n或m:n)联系的属性:联系本身也是一种实体型,也可以有属性。如果一个联系具有属性,则这些属性也要用无向边与该联系连接起来
第八十二页,共一百一十四页,2022年,8月28日联系的表示方法实体型1联系名实体型2111:1联系实体型1联系名实体型2mnm:n联系实体型1联系名实体型21n1:n联系第八十三页,共一百一十四页,2022年,8月28日联系的表示方法(续)实体型1联系名mn同一实体型内部的m:n联系实体型1联系名实体型21m多个实体型间的1:n联系实体型3n第八十四页,共一百一十四页,2022年,8月28日联系的表示方法示例班级班级-班长班长111:1联系课程选修学生mnm:n联系班级组成学生1n1:n联系第八十五页,共一百一十四页,2022年,8月28日联系的表示方法示例(续)职工领导1n同一实体型内部的1:n联系课程讲授教师1m多个实体型间的1:n联系参考书n第八十六页,共一百一十四页,2022年,8月28日联系属性的表示方法课程选修学生mn成绩第八十七页,共一百一十四页,2022年,8月28日ERDDevelopmentforaBeerBar?第八十八页,共一百一十四页,2022年,8月28日ExampleDrinkersaddrnameBeersmanfnameBarsnamelicenseaddrNote:license=beer,full,noneSellsBarssellsomebeers.LikesDrinkerslikesomebeers.FrequentsDrinkersfrequentsomebars.第八十九页,共一百一十四页,2022年,8月28日ERDDevelopmentforalibrary?第九十页,共一百一十四页,2022年,8月28日同一实体集内各实体间的联系一对多联系实例
职工实体集内部具有领导与被领导的联系某一职工(干部)“领导”若干名职工一个职工仅被另外一个职工直接领导这是一对多的联系一对一联系多对多联系第九十一页,共一百一十四页,2022年,8月28日DataModelsAcollectionoftoolsfordescribingDataDatarelationshipsDatasemanticsDataconstraints第九十二页,共一百一十四页,2022年,8月28日DataModelsTypeRelationalmodelEntity-Relationshipdatamodel(mainlyfordatabasedesign)Object-baseddatamodels(Object-orientedandObject-relational)Semi-structureddatamodel(XML)Otheroldermodels:NetworkmodelHierarchicalmodel第九十三页,共一百一十四页,2022年,8月28日RelationalModelArelationaldatabaseisbasedontherelationalmodelandusesacollectionoftablestorepresentbothdataandrelationshipsamongthosedata.ExampleoftabulardataintherelationalmodelAttributes第九十四页,共一百一十四页,2022年,8月28日InstanceofStudentsRelationStudents(sid:string,name:string,login:string, age:integer,gpa:real)sid name login age gpa53666 Jones jones@cs 18 3.453688 Smith smith@ee 18 3.253650 Smith smith@math 19 3.8第九十五页,共一百一十四页,2022年,8月28日ASampleRelationalDatabase第九十六页,共一百一十四页,2022年,8月28日Example:UniversityDatabaseConceptualschema:
Students(sid:string,name:string,login:string, age:integer,gpa:real)Courses(cid:string,cname:string,credits:integer)Enrolled(sid:string,cid:string,grade:string)Physicalschema:Relationsstoredasunorderedfiles.IndexonfirstcolumnofStudents.ExternalSchema(View):
Course_info(cid:string,enrollment:integer)第九十七页,共一百一十四页,2022年,8月28日DataManipulationLanguage(DML)Languageforaccessingandmanipulatingthedataorganizedbytheappropriatedatamodel.DMLalsoknownasquerylanguageRetrievalofinformationstoredinthedatabaseInsertionofnewinformationintothedatabseDeletionofinformationfromthedatabaseModificationofinformationstoredinthedatabaseTwoclassesoflanguagesProcedural–userspecifieswhatdataisrequiredandhowtogetthosedataDeclarative(nonprocedural)–userspecifieswhatdataisrequiredwithoutspecifyinghowtogetthosedataSQListhemostwidelyusedquerylanguage第九十八页,共一百一十四页,2022年,8月28日DataDefinitionLanguage(DDL)SpecificationnotationfordefiningthedatabaseschemaExample: createtable
account(
account-number
char(10),
balance
integer)DDLcompilergeneratesasetoftablesstoredinadatadictionaryDatadictionarycontainsmetadata(元数据)(i.e.,dataaboutdata)DatabaseschemaDatastorageanddefinitionlanguageSpecifiesthestoragestructureandaccessmethodsusedIntegrityconstraintsDomainconstraintsReferentialintegrity(referencesconstraintinSQL)AssertionsAuthorization第九十九页,共一百一十四页,2022年,8月28日SQLSQL:widelyusednon-procedurallanguageExample:Findthenameofthecustomerwithcustomer_id192-83-7465
select customer.customer_name
from customer
where customer.customer_id=‘192-83-7465’Example:Findthebalancesofallaccountsheldbythecustomerwithcustomer_id192-83-7465
select account.balance
from depositor,account
where depositor.customer_id=‘192-83-7465’and
depositor.account_number=account.account_numberApplicationprogramsgenerallyaccessdatabasesthroughoneofLanguageextensionstoallowembeddedSQLApplicationprograminterface(API)(e.g.,ODBC/JDBC)whichallowSQLqueriestobesenttoadatabase第一百页,共一百一十四页,2022年,8月28日DatabaseDesignTheprocessofdesigningthegeneralstructureofthedatabase:LogicalDesign
–Decidingonthedatabaseschema.Databasedesignrequiresthatwefinda“good”collectionofrelationschemas.Businessdecision
–
Whatattributesshouldwerecordinthedatabase?ComputerSciencedecision
–Whatrelationschemasshouldwehaveandhowshouldtheattributesbedistributedamongthevariousrelationschemas?PhysicalDesign
–Decidingonthephysicallayoutofthedatabase第一百零一页,共一百一十四页,2022年,8月28日TheEntity-RelationshipModelModelsanenterpriseasacollectionofentities
andrelationshipsEntity:a“thing”or“object”intheenterprisethatisdistinguishablefromotherobjectsDescribedbyasetofattributesRelationship:anassociationamongseveralentitiesRepresenteddiagrammaticallybyanentity-relationshipdiagram:第一百零二页,共一百一十四页,2022年,8月28日Object-RelationalDataModelsExtendtherelationaldatamodelbyincludingobjectorientationandconstructstodealwithaddeddatatypes.Allowattributesoftuplestohavecomplextypes,includingnon-atomicvaluessuchasnestedrelations.Preserverelationalfoundations,inparticularthedeclarativeaccesstodata,whileextendingmodelingpower.Provideupwardcompatibilitywithexistingrelationallanguages.第一百零三页,共一百一十四页,2022年,8月28日XML:ExtensibleMarkupLanguageDefinedbytheWWWConsortium(W3C)OriginallyintendedasadocumentmarkuplanguagenotadatabaselanguageTheabilitytospecifynewtags,andtocreatenestedtagstructuresmadeXMLagreatwaytoexchangedata,notjustdocumentsXMLhasbecomethebasisforallnewgenerationdatainterchangeformats.Awidevarietyoftoolsisavailableforparsing,browsingandqueryingXMLdocuments/data第一百零四页,共一百一十四页,2022年,8月28日StorageManagementStoragemanagerisaprogrammodulethatprovidestheinterfacebetweenthelow-leveldatastored
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年三针六线包缝机项目投资可行性研究分析报告
- 2025年翻领工装茄克项目投资可行性研究分析报告
- 2022-2027年中国帽类行业市场深度分析及投资规划建议报告
- 2024-2030年中国钢易拉罐行业市场发展监测及投资潜力预测报告
- 2025年中国滋阴清热用药行业市场调研分析及投资战略咨询报告
- 2025年中国单克隆抗体行业市场深度分析及投资战略规划报告
- 2022-2027年中国腹腔镜吻合器行业市场运行现状及投资规划建议报告
- 金属电气钢导管项目可行性研究报告
- 中国打包条项目投资可行性研究报告
- 2025年中国消防检测维修车行业发展监测及投资战略规划建议报告
- 2024年4月自考00263外国法制史试题及答案
- 《井中分布式光纤声波传感数据采集规程》标准报批稿
- 人音版 音乐 八年级下册 第一单元 我和你教案
- 代理法人免责协议书版本
- 2024年青岛港湾职业技术学院单招职业适应性测试题库必考题
- 门诊导诊课件
- python程序设计-说课
- 《糖尿病患者血脂管理中国专家共识(2024版)》解读
- 广州石牌村改造规划方案
- GB/T 22919.12-2024水产配合饲料第12部分:鲫鱼配合饲料
- IP承载网架构规划及路由部署N
评论
0/150
提交评论