應(yīng)用層協(xié)議及其安全實(shí)踐_第1頁
應(yīng)用層協(xié)議及其安全實(shí)踐_第2頁
應(yīng)用層協(xié)議及其安全實(shí)踐_第3頁
應(yīng)用層協(xié)議及其安全實(shí)踐_第4頁
應(yīng)用層協(xié)議及其安全實(shí)踐_第5頁
已閱讀5頁,還剩109頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

應(yīng)用層協(xié)議及其安全實(shí)踐第1頁,共114頁,2023年,2月20日,星期四WhyStudyDatabases??Shiftfromcomputationtoinformationatthe“l(fā)owend”:scrambletowebspace(amess!)atthe“highend”:scientificapplicationsDatasetsincreasingindiversityandvolume.Digitallibraries,interactivevideo,HumanGenomeproject,EOSproject...needforDBMSexplodingDBMSencompassesmostofCSOS,languages,theory,“AI”,multimedia,logic?ScienceComputingProcessingControlDataProcessing(70%)第2頁,共114頁,2023年,2月20日,星期四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第3頁,共114頁,2023年,2月20日,星期四MoreopportunitiesinthejobmarketCareerdevelopmentComputerskillsBenefitsfor…第4頁,共114頁,2023年,2月20日,星期四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.薩師煊,王珊:數(shù)據(jù)庫系統(tǒng)概論(第四版),高等教育出版社,2000.中國人民大學(xué)周立柱、馮建華等《SQLServer數(shù)據(jù)庫原理--設(shè)計(jì)與實(shí)現(xiàn)》第5頁,共114頁,2023年,2月20日,星期四采用直觀的方式描述所有概念,并以結(jié)構(gòu)清晰的圖示和例子代替形式化的證明。以銀行數(shù)據(jù)庫實(shí)例生動(dòng)地解釋重要概念,增強(qiáng)了本書的易讀性。專門用三章來介紹特定的商品化數(shù)據(jù)庫系統(tǒng)Oracle、MicrosoftSQLServer和IBMDB2的細(xì)節(jié)。配有關(guān)于網(wǎng)狀模型和層次模型的聯(lián)機(jī)附錄(英文)。第6頁,共114頁,2023年,2月20日,星期四1950,負(fù)責(zé)全校經(jīng)濟(jì)和管理類公共數(shù)學(xué)課的教學(xué)工作,文科數(shù)學(xué)。83年,與王珊第一版數(shù)據(jù)庫泰斗多次獎(jiǎng)項(xiàng)多次規(guī)劃教材使用學(xué)生眾多第7頁,共114頁,2023年,2月20日,星期四8CourseOutlineIntroductiontoDatabaseManagementSystemsEntity-RelationshipModelTheRelationalDataModelRelationalAlgebraSQLRelationalDatabaseDesign:NormalizationMSSQLserver第8頁,共114頁,2023年,2月20日,星期四9GradingAssignments 10%Experiments 40%FinalExam 60%

第9頁,共114頁,2023年,2月20日,星期四Howtolearnwell?網(wǎng)絡(luò)資源精品課程網(wǎng)絡(luò)視頻第10頁,共114頁,2023年,2月20日,星期四IntroductiontoDBMSWhatIsaDBMS?WhatAboutDBMSHistory?WhyUseDBMS?FunctionsofDBMS?DBMSArchitecture?第11頁,共114頁,2023年,2月20日,星期四WhatIsaDBMS?Data(數(shù)據(jù))Database(數(shù)據(jù)庫)DBMS(數(shù)據(jù)庫管理系統(tǒng))DBS(數(shù)據(jù)庫系統(tǒng))第12頁,共114頁,2023年,2月20日,星期四DataTherepresentativeformsofinformation,includingfacts,concepts,rules,oranyotherkindofknowledge.numbers,characters,imagesorothermethodsofrecording.representvaluesthatcanbestored,processed,andtransmittedbyelectronicsystems,especiallythecomputer.第13頁,共114頁,2023年,2月20日,星期四Datainstance學(xué)生檔案中的學(xué)生記錄(李明,男,1972,江蘇,計(jì)算機(jī)系,1990)數(shù)據(jù)的解釋語義:學(xué)生姓名、性別、出生年月、籍貫、所在系別、入學(xué)時(shí)間解釋:李明是個(gè)大學(xué)生,1972年出生,江蘇人,1990年考入計(jì)算機(jī)系數(shù)據(jù)的形式不能完全表達(dá)其內(nèi)容第14頁,共114頁,2023年,2月20日,星期四DatabaseAverylarge,integratedcollectionofdatastoredinthecomputer.LowreductdanceShareabilityDataindependenceIntegritymanagementandcontrol第15頁,共114頁,2023年,2月20日,星期四Averylarge,integratedcollectionofdatastoredinthecomputerModelsreal-worldenterprise.Entities(e.g.,students,courses)Relationships(e.g.,TarkanistakingCENG302)ADatabaseManagementSystem(DBMS)

isasoftwarepackagedesignedtostoreandmanagedatabases.DatabaseManagementSystem(DBMS)第16頁,共114頁,2023年,2月20日,星期四OracleSQLserverSybaseMysqlDB2INFORMIXVFPDatabasemanagementsystemexamples第17頁,共114頁,2023年,2月20日,星期四DataDefinitionDDL,DataDefinitionLanguageDataManipulationDML,DataManipulationLanguageOperationManagementSetupandMaintainDBMSFUNCTION第18頁,共114頁,2023年,2月20日,星期四ProvideUserInterfaceProvideDataManipulationLanguageProvideDataDefinitionLanguageProvidesometoolsManagedatabaseMaintaindatabaseDBMSFUNCTION(continue)第19頁,共114頁,2023年,2月20日,星期四C,VC,C++VBPOWERBUILDERDELPHIJAVAASP/JSPODBC/JDBCDatabaselanguage(DDL,DML)Developmenttoolkits/language第20頁,共114頁,2023年,2月20日,星期四開放數(shù)據(jù)庫互連(ODBC)是MICROSOFT提出的數(shù)據(jù)庫訪問接口標(biāo)準(zhǔn)。開放數(shù)據(jù)庫互連定義了訪問數(shù)據(jù)庫的API一個(gè)規(guī)范,這些API獨(dú)立于不同廠商的DBMS,也獨(dú)立于具體的編程語言。OpenDatabaseConnectOracleSqlserversybaseaccessODBCAPIODBC驅(qū)動(dòng)C++VBPBJAVA第21頁,共114頁,2023年,2月20日,星期四JavaDatabaseConnect(JDBC)Java數(shù)據(jù)庫連接,(JavaDatabaseConnectivity,簡稱JDBC)是Java語言中用來規(guī)范客戶端程序如何來訪問數(shù)據(jù)庫的應(yīng)用程序接口,提供了諸如查詢和更新數(shù)據(jù)庫中數(shù)據(jù)的方法。JDBC也是SunMicrosystems的商標(biāo)。它JDBC是面向關(guān)系型數(shù)據(jù)庫的。第22頁,共114頁,2023年,2月20日,星期四硬件操作系統(tǒng)DBMS應(yīng)用開發(fā)工具應(yīng)用系統(tǒng)第23頁,共114頁,2023年,2月20日,星期四DatabaseManagementSystem(DBMS)DBMScontainsinformationaboutaparticularenterpriseCollectionofinterrelateddata--DatabaseSetofprogramstoaccessthedataAnenvironmentthatisbothconvenientandefficienttouseDatabaseapplicationsBanking:alltransactionsAirlines:reservations,schedulesUniversities:registration,gradesSales:customers,products,purchasesOnlineretailers:ordertracking,customizedrecommendationsManufacturing:production,inventory,orders,supplychainHumanresources:employeerecords,salaries,taxdeductions

Databasestouchallaspectsofourlives第24頁,共114頁,2023年,2月20日,星期四DatabaseOperationsystemDBMSApplicationsystemDBAUsersDatabaseSystem(DBS)數(shù)據(jù)庫系統(tǒng)一般由數(shù)據(jù)庫、操作系統(tǒng)、數(shù)據(jù)庫管理系統(tǒng)(及其開發(fā)工具)、應(yīng)用系統(tǒng)、數(shù)據(jù)庫管理員(DBA)和用戶構(gòu)成。第25頁,共114頁,2023年,2月20日,星期四USERUSERUSERApplicationDBMSOSDBDBA用戶用戶用戶應(yīng)用系統(tǒng)數(shù)據(jù)庫管理員DevelopmentToolskits開發(fā)工具Databasesystem第26頁,共114頁,2023年,2月20日,星期四DatabasesystemArchitecture

Thearchitectureofadatabasesystemsisgreatlyinfluencedbytheunderlyingcomputersystemonwhichthedatabaseisrunning:CentralizedClient-serverParallel(multi-processor)Distributed

Browser/Server第27頁,共114頁,2023年,2月20日,星期四Centralized(集中式系統(tǒng))

DBMS和應(yīng)用程序以及與用戶終端進(jìn)行通信的軟件等都運(yùn)行在一臺(tái)宿主計(jì)算機(jī)上,所有的數(shù)據(jù)處理都是在宿主計(jì)算機(jī)中進(jìn)行。宿主計(jì)算機(jī)一般是大型機(jī)、中型機(jī)或小型機(jī)。應(yīng)用程序和DBMS之間通過操作系統(tǒng)管理的共享內(nèi)存或應(yīng)用任務(wù)區(qū)來進(jìn)行通信,DBMS利用操作系統(tǒng)提供的服務(wù)來訪問數(shù)據(jù)庫。終端通常是非智能的,本身沒有處理能力。集中系統(tǒng)的主要優(yōu)點(diǎn)是:具有集中的安全控制,以及處理大量數(shù)據(jù)和支持大量并發(fā)用戶的能力。集中系統(tǒng)的主要缺點(diǎn)是:購買和維持這樣的系統(tǒng)一次性投資太大,并且不適合分布處理。PC(個(gè)人計(jì)算機(jī)系統(tǒng))

與大型系統(tǒng)不同,通常個(gè)人計(jì)算機(jī)(微機(jī))上的DBMS功能和數(shù)據(jù)庫應(yīng)用功能是結(jié)合在一個(gè)應(yīng)用程序中的,這類DBMS(如FoxPro、Acssce)的功能靈活,系統(tǒng)結(jié)構(gòu)簡潔,運(yùn)行速度快,但這類DBMS的數(shù)據(jù)共享性、安全性、完整性等控制功能比較薄弱。第28頁,共114頁,2023年,2月20日,星期四在客戶/服務(wù)器(簡記為C/S)結(jié)構(gòu)的數(shù)據(jù)庫系統(tǒng)中,數(shù)據(jù)處理任務(wù)被劃分為兩部分:一部分運(yùn)行在客戶端,另一部分運(yùn)行在服務(wù)器端??蛻舳素?fù)責(zé)應(yīng)用處理,數(shù)據(jù)庫服務(wù)器完成DBMS的核心功能。這種模型中,客戶機(jī)上都必須安裝應(yīng)用程序和工具,客戶端比較龐大、負(fù)擔(dān)比較重,而且系統(tǒng)安裝、維護(hù)、升級(jí)和發(fā)布困難,從而影響效率。

Client-server(客戶/服務(wù)器系統(tǒng))第29頁,共114頁,2023年,2月20日,星期四一個(gè)分布式數(shù)據(jù)系統(tǒng)由一個(gè)邏輯數(shù)據(jù)庫組成,整個(gè)邏輯數(shù)據(jù)庫的數(shù)據(jù),存儲(chǔ)在分布于網(wǎng)絡(luò)中的多個(gè)結(jié)點(diǎn)上的物理數(shù)據(jù)庫中。在當(dāng)今的客戶/服務(wù)器結(jié)構(gòu)的數(shù)據(jù)庫系統(tǒng)中,服務(wù)器的數(shù)目可以是一個(gè)或多個(gè)。當(dāng)系統(tǒng)中存在多個(gè)數(shù)據(jù)庫服務(wù)器時(shí)就形成了分布系統(tǒng)。Distributed(分布式系統(tǒng))第30頁,共114頁,2023年,2月20日,星期四Distributedsystem第31頁,共114頁,2023年,2月20日,星期四隨著Internet的迅速普及,出現(xiàn)了三層客戶機(jī)/服務(wù)器模型:客戶機(jī)→應(yīng)用服務(wù)器→數(shù)據(jù)庫服務(wù)器。這種系統(tǒng)稱為瀏覽器/服務(wù)器(Browser/Server,簡記為B/S)系統(tǒng)。Browser/Server(瀏覽器/服務(wù)器系統(tǒng))第32頁,共114頁,2023年,2月20日,星期四WhyWeNeedaDBMS?theincreasingofthegreatnumberofinformationresourcesKB,MB,GB,TB,PB,EB,ZB,YBTraditionaldatamanagementtechnologycannotmeettheincreasingneedsMassivebenefitsthroughdataanalysisandprocessingWeatherforecastairspaceBankandstocksmarketDBMSisthebestwaytosolvetheabovequestions第33頁,共114頁,2023年,2月20日,星期四WhyUseaDBMS?Dataindependenceandefficientaccess.(數(shù)據(jù)獨(dú)立性和高效訪問)Reducedapplicationdevelopmenttime.(減少應(yīng)用程序開發(fā)時(shí)間)Dataintegrityandsecurity.(數(shù)據(jù)完整性和安全性)Uniformdataadministration.(統(tǒng)一的數(shù)據(jù)管理)Concurrentaccess,recoveryfromcrashes.(并發(fā)控制和災(zāi)難恢復(fù))第34頁,共114頁,2023年,2月20日,星期四DatamanagementhistoryDatamanagementthecontrolofdatahandlingoperations--suchasacquisition,analysis,translation,coding,storage,retrieval,anddistributionofdata

Development

Manualmanagement(1940s—mid1950s)Filesystemmanagement(1950s—mid1960s)Databasemanagement(1960s--)第35頁,共114頁,2023年,2月20日,星期四Manualmanagement1940s-1950sFocusonscientificcomputingHardware nodirectaccessstoragedeviceSoftwaresystemnooperationsystem Dataprocessingbatchprocessing 第36頁,共114頁,2023年,2月20日,星期四Filemanagement1950sandearly1960s:DataprocessingusingmagnetictapesforstorageTapesprovideonlysequentialaccessPunchedcardsforinput1960sFilesystem(Intheearlydays,databaseapplicationswerebuiltdirectlyontopoffilesystems)Demand

scientificmanagementHardware

disk、diskdrum

Softwarefilesystem

ProcessingOLAP、batchprocessing第37頁,共114頁,2023年,2月20日,星期四DrawbacksofusingfilesystemsDrawbacksofusingfilesystemstostoredata:DataredundancyandinconsistencyMultiplefileformats,duplicationofinformationindifferentfilesDifficultyinaccessingdataNeedtowriteanewprogramtocarryouteachnewtaskDataisolation—multiplefilesandformatsIntegrityproblemsIntegrityconstraints(e.g.accountbalance>0)become“buried”inprogramcoderatherthanbeingstatedexplicitlyHardtoaddnewconstraintsorchangeexistingones第38頁,共114頁,2023年,2月20日,星期四Drawbacksofusingfilesystems(Cont.)AtomicityofupdatesFailuresmayleavedatabaseinaninconsistentstatewithpartialupdatescarriedoutExample:TransferoffundsfromoneaccounttoanothershouldeithercompleteornothappenatallConcurrentaccessbymultipleusersConcurrentaccessedneededforperformanceUncontrolledconcurrentaccessescanleadtoinconsistenciesExample:TwopeoplereadingabalanceandupdatingitatthesametimeSecurityproblemsHardtoprovideuseraccesstosome,butnotall,dataDatabasesystemsoffersolutionstoalltheaboveproblems第39頁,共114頁,2023年,2月20日,星期四HistoryofDatabaseSystemsLate1960sand1970s:HarddisksallowdirectaccesstodataNetworkandhierarchicaldatamodelsinwidespreaduseTedCodddefinestherelationaldatamodelWouldwintheACMTuringAwardforthisworkIBMResearchbeginsSystemRprototypeUCBerkeleybeginsIngresprototypeHigh-performance(fortheera)transactionprocessing第40頁,共114頁,2023年,2月20日,星期四History(cont.)1980s:ResearchrelationalprototypesevolveintocommercialsystemsSQLbecomesindustrialstandardParallelanddistributeddatabasesystemsObject-orienteddatabasesystems1990s:Largedecisionsupportanddata-miningapplicationsLargemulti-terabytedatawarehousesEmergenceofWebcommerce2000s:XMLandXQuerystandardsAutomateddatabaseadministration第41頁,共114頁,2023年,2月20日,星期四Database-AdvantagesReduceddataredundancy(冗余)Reducedupdatingerrorsandincreasedconsistency(一致性)Greaterdataintegrityandindependencefromapplicationsprograms(完整性和獨(dú)立性)Improveddataaccesstousersthroughuseofhostandquerylanguages(訪問能力)Improveddatasecurity(數(shù)據(jù)安全)Reduceddataentry,storage,andretrievalcosts(減少數(shù)據(jù)存取開銷)Facilitateddevelopmentofnewapplicationsprogram(為開發(fā)新程序提供便利第42頁,共114頁,2023年,2月20日,星期四SummaryDBMS-howcometodayDemanddrivenbyapplicationrequirementsSoftwaredevelopmentHardwaredevelopment第43頁,共114頁,2023年,2月20日,星期四1、試述數(shù)據(jù)、數(shù)據(jù)庫、數(shù)據(jù)庫管理系統(tǒng)、數(shù)據(jù)庫系統(tǒng)的概念;2、使用數(shù)據(jù)庫有什么好處?3、試述文件系統(tǒng)和數(shù)據(jù)庫系統(tǒng)的區(qū)別與聯(lián)系。4、名詞解釋:數(shù)據(jù)定義語言;數(shù)據(jù)操縱語言。5、試述數(shù)據(jù)庫系統(tǒng)的功能。6、以圖書館管理系統(tǒng)為例,試述開發(fā)一個(gè)數(shù)據(jù)庫應(yīng)用程序的大致步驟。Assignment第44頁,共114頁,2023年,2月20日,星期四概念模型和三級(jí)模式結(jié)構(gòu)第45頁,共114頁,2023年,2月20日,星期四shiftfromtherealworldtoConceptschema客觀對(duì)象的抽象過程兩步抽象現(xiàn)實(shí)世界中的客觀對(duì)象抽象為概念模型;把概念模型轉(zhuǎn)換為某一DBMS支持的數(shù)據(jù)模型。概念模型是現(xiàn)實(shí)世界到機(jī)器世界的一個(gè)中間層次。

數(shù)據(jù)庫中用數(shù)據(jù)模型來抽象、表示和處理現(xiàn)實(shí)世界中的數(shù)據(jù)。第46頁,共114頁,2023年,2月20日,星期四DBMSArchitecturedataUserviewComputerviewDBMS-schemaanddatamodelshiftfromtherealworldtodigitalworld第47頁,共114頁,2023年,2月20日,星期四Conceptschema概念模型的用途概念模型用于信息世界的建模是現(xiàn)實(shí)世界到機(jī)器世界的一個(gè)中間層次是數(shù)據(jù)庫設(shè)計(jì)的有力工具數(shù)據(jù)庫設(shè)計(jì)人員和用戶之間進(jìn)行交流的語言對(duì)概念模型的基本要求較強(qiáng)的語義表達(dá)能力,能夠方便、直接地表達(dá)應(yīng)用中的各種語義知識(shí)簡單、清晰、易于用戶理解。第48頁,共114頁,2023年,2月20日,星期四redundantandinconsistentflexibilitymultipledatabases第49頁,共114頁,2023年,2月20日,星期四SchemasExternalschemaforuserviewsdefinestheviewofthedatapresentedtothe applicationprogramsConceptualschemaintegratesexternalschematathelogicalstructureofthedatabaseTheprimaryobjectiveofthisconceptualschemaistoprovideaconsistentdefinitionofthemeaningsandinterrelationshipofdatawhichcanbeusedtointegrate,share,andmanagetheintegrityofdata.Internalschemathatdefinesphysicalstoragestructuresdescribestheinternalformatsofthedatastoredinthedatabase第50頁,共114頁,2023年,2月20日,星期四AdvantageofThreeSchemaslayeredarchitecture第51頁,共114頁,2023年,2月20日,星期四ViewofDataAnarchitectureforadatabasesystem第52頁,共114頁,2023年,2月20日,星期四DataIndependenceApplicationsinsulatedfromhowdataisstructuredandstored.Logicaldataindependence:Protectionfromchangesinlogicalstructureofdata.Physicaldataindependence:Protectionfromchangesinphysicalstructureofdata.

OneofthemostimportantbenefitsofusingaDBMS!第53頁,共114頁,2023年,2月20日,星期四LevelsofAbstractionManyexternalschemata,singleconceptual(logical)

schema

andphysicalschema.Externalschematadescribehowusersseethedata.ConceptualschemadefineslogicalstructurePhysicalschemadescribesthefilesandindexesused.

SchemasaredefinedusingDDL;dataismodified/queriedusingDML.PhysicalSchemaConceptualSchemaExternalSchema1ExternalSchema3ExternalSchema2第54頁,共114頁,2023年,2月20日,星期四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.第55頁,共114頁,2023年,2月20日,星期四InstancesandSchemasSimilartotypesandvariablesinprogramminglanguagesSchema–thelogicalstructureofthedatabaseExample:ThedatabaseconsistsofinformationaboutasetofcustomersandaccountsandtherelationshipbetweenthemAnalogoustotypeinformationofavariableinaprogramPhysicalschema:databasedesignatthephysicallevelLogicalschema:databasedesignatthelogicallevelInstance–theactualcontentofthedatabaseataparticularpointintimeAnalogoustothevalueofavariablePhysicalDataIndependence–theabilitytomodifythephysicalschemawithoutchangingthelogicalschemaApplicationsdependonthelogicalschemaIngeneral,theinterfacesbetweenthevariouslevelsandcomponentsshouldbewelldefinedsothatchangesinsomepartsdonotseriouslyinfluenceothers.第56頁,共114頁,2023年,2月20日,星期四StructureofaDBMSAtypicalDBMShasalayeredarchitecture.Thisisoneofseveralpossiblearchitectures;eachsystemhasitsownvariations.QueryOptimizationandExecutionRelationalOperatorsFilesandAccessMethodsBufferManagementDiskSpaceManagementDBTheselayersmustconsiderconcurrencycontrolandrecovery第57頁,共114頁,2023年,2月20日,星期四StructureofaDBMS第58頁,共114頁,2023年,2月20日,星期四Howdataisorganizedinthedatabase?DataModels第59頁,共114頁,2023年,2月20日,星期四DataModelsAdatamodel

isacollectionofconceptsfordescribingdata.Aschema

isadescriptionofaparticularcollectionofdata,usingthegivendatamodel.requirement能比較真實(shí)地模擬現(xiàn)實(shí)世界容易為人所理解便于在計(jì)算機(jī)上實(shí)現(xiàn)Therelationalmodelofdata

isthemostwidelyusedmodeltoday.Mainconcept:

relation,basicallyatablewithrowsandcolumns.Everyrelationhasaschema,whichdescribesthecolumns,orfields.第60頁,共114頁,2023年,2月20日,星期四DataModelsTypeEntity-Relationshipdatamodel(mainlyfordatabasedesign)RelationalmodelObject-baseddatamodels(Object-orientedandObject-relational)Semistructureddatamodel(XML)Otheroldermodels:NetworkmodelHierarchicalmodel第61頁,共114頁,2023年,2月20日,星期四SummaryConceptmodelExternalschemaConceptschemaInternalschemaDatamodelRelationalmodel第62頁,共114頁,2023年,2月20日,星期四Conceptschema概念模型的用途概念模型用于信息世界的建模是現(xiàn)實(shí)世界到機(jī)器世界的一個(gè)中間層次是數(shù)據(jù)庫設(shè)計(jì)的有力工具數(shù)據(jù)庫設(shè)計(jì)人員和用戶之間進(jìn)行交流的語言對(duì)概念模型的基本要求較強(qiáng)的語義表達(dá)能力,能夠方便、直接地表達(dá)應(yīng)用中的各種語義知識(shí)簡單、清晰、易于用戶理解。第63頁,共114頁,2023年,2月20日,星期四definitions實(shí)體(Entity)“thing”orobject屬性(Attribute)Propertyof(theentitiesof)anentityset.Attributesaresimplevalues,egersorcharacterstrings.實(shí)體型(EntityType)aclassofentitieswiththesameattributes實(shí)體集(EntitySet)同型實(shí)體的集合稱為實(shí)體集第64頁,共114頁,2023年,2月20日,星期四ExampleEntitysetBeershastwoattributes,nameandmanf(manufacturer).EachBeersentityhasvaluesforthesetwoattributes,e.g.(Bud,Anheuser-Busch)Beersnamemanf第65頁,共114頁,2023年,2月20日,星期四definitions(conti.)碼(Key)唯一標(biāo)識(shí)實(shí)體的屬性集稱為碼。域(Domain)屬性的取值范圍稱為該屬性的域。第66頁,共114頁,2023年,2月20日,星期四definitions(conti.)聯(lián)系(Relationship)

anassociationbetweentwoormoreentitiesthatisofparticularinterest現(xiàn)實(shí)世界中事物內(nèi)部以及事物之間的聯(lián)系在信息世界中反映為實(shí)體內(nèi)部的聯(lián)系和實(shí)體之間的聯(lián)系。實(shí)體型間聯(lián)系兩個(gè)實(shí)體型一對(duì)一聯(lián)系(1:1)三個(gè)實(shí)體型一對(duì)多聯(lián)系(1:n)一個(gè)實(shí)體型多對(duì)多聯(lián)系(m:n)

第67頁,共114頁,2023年,2月20日,星期四兩個(gè)實(shí)體型間的聯(lián)系一對(duì)一聯(lián)系如果對(duì)于實(shí)體集A中的每一個(gè)實(shí)體,實(shí)體集B中至多有一個(gè)實(shí)體與之聯(lián)系,反之亦然,則稱實(shí)體集A與實(shí)體集B具有一對(duì)一聯(lián)系。記為1:1。

實(shí)例班級(jí)與班長之間的聯(lián)系:一個(gè)班級(jí)只有一個(gè)正班長一個(gè)班長只在一個(gè)班中任職第68頁,共114頁,2023年,2月20日,星期四兩個(gè)實(shí)體型間的聯(lián)系(續(xù))一對(duì)多聯(lián)系如果對(duì)于實(shí)體集A中的每一個(gè)實(shí)體,實(shí)體集B中有n個(gè)實(shí)體(n≥0)與之聯(lián)系,反之,對(duì)于實(shí)體集B中的每一個(gè)實(shí)體,實(shí)體集A中至多只有一個(gè)實(shí)體與之聯(lián)系,則稱實(shí)體集A與實(shí)體集B有一對(duì)多聯(lián)系記為1:n實(shí)例班級(jí)與學(xué)生之間的聯(lián)系:一個(gè)班級(jí)中有若干名學(xué)生,每個(gè)學(xué)生只在一個(gè)班級(jí)中學(xué)習(xí)第69頁,共114頁,2023年,2月20日,星期四兩個(gè)實(shí)體型間的聯(lián)系(續(xù))多對(duì)多聯(lián)系(m:n)如果對(duì)于實(shí)體集A中的每一個(gè)實(shí)體,實(shí)體集B中有n個(gè)實(shí)體(n≥0)與之聯(lián)系,反之,對(duì)于實(shí)體集B中的每一個(gè)實(shí)體,實(shí)體集A中也有m個(gè)實(shí)體(m≥0)與之聯(lián)系,則稱實(shí)體集A與實(shí)體B具有多對(duì)多聯(lián)系。記為m:n實(shí)例課程與學(xué)生之間的聯(lián)系:一門課程同時(shí)有若干個(gè)學(xué)生選修一個(gè)學(xué)生可以同時(shí)選修多門課程第70頁,共114頁,2023年,2月20日,星期四多個(gè)實(shí)體型間的聯(lián)系(續(xù))多個(gè)實(shí)體型間的一對(duì)多聯(lián)系若實(shí)體集E1,E2,...,En存在聯(lián)系,對(duì)于實(shí)體集Ej(j=1,2,...,i-1,i+1,...,n)中的給定實(shí)體,最多只和Ei中的一個(gè)實(shí)體相聯(lián)系,則我們說Ei與E1,E2,...,Ei-1,Ei+1,...,En之間的聯(lián)系是一對(duì)多的。第71頁,共114頁,2023年,2月20日,星期四多個(gè)實(shí)體型間的聯(lián)系(續(xù))實(shí)例

課程、教師與參考書三個(gè)實(shí)體型如果一門課程可以有若干個(gè)教師講授,使用若干本參考書,每一個(gè)教師只講授一門課程,每一本參考書只供一門課程使用課程與教師、參考書之間的聯(lián)系是一對(duì)多的多個(gè)實(shí)體型間的一對(duì)一聯(lián)系多個(gè)實(shí)體型間的多對(duì)多聯(lián)系第72頁,共114頁,2023年,2月20日,星期四DegreesofrelationshipManWomanCustomerOrderCourseSubjectOne-to-one(1:1)One-to-many(1:n)Many-to-many(n:m)NOTE:Everymanytomanyrelationshipconsistsoftwoonetomanyrelationshipsworkinginoppositedirections第73頁,共114頁,2023年,2月20日,星期四概念模型的表示方法概念模型的表示方法很多實(shí)體-聯(lián)系方法(E-R方法)用E-R圖來描述現(xiàn)實(shí)世界的概念模型E-R方法也稱為E-R模型第74頁,共114頁,2023年,2月20日,星期四WhyuseERDiagrams?

providesaglobalquickreferencetoanorganization’sdatastructures.canbeusedindividuallytodesignanInformationSystem’s(IS)datastructurecanbeusedwithDataFlowDiagramstoprovideamorecomprehensiveISlogicaldesign.第75頁,共114頁,2023年,2月20日,星期四ERDDevelopmentProcessIdentifytheentitiesDeterminetheattributesforeachentitySelecttheprimarykeyforeachentityEstablishtherelationshipsbetweentheentitiesDrawanentitymodelTesttherelationshipsandthekeys第76頁,共114頁,2023年,2月20日,星期四Identifytheentities實(shí)體型用矩形表示,矩形框內(nèi)寫明實(shí)體名。Entityset=rectangle.學(xué)生教師第77頁,共114頁,2023年,2月20日,星期四Determinetheattributesforeachentity屬性用橢圓形表示,并用無向邊將其與相應(yīng)的實(shí)體連接起來Attribute=oval,withalinetotherectanglerepresentingitsentityset.學(xué)生學(xué)號(hào)年齡性別姓名第78頁,共114頁,2023年,2月20日,星期四KeyAttributesCertainattributesidentifyparticularfactswithinanentity,theseareknownasKEYattributes.ThedifferenttypesofKEYattributeare:PrimaryKeyCompositePrimaryKeyForeignKey第79頁,共114頁,2023年,2月20日,星期四KeyDefinitionsPrimaryKey:Oneattributewhosevaluecanuniquelyidentifyacompleterecord(onerowofdata)withinanentity.CompositePrimaryKeyAprimarykeythatconsistsoftwoormoreattributewithinanentity.ForeignKeyAcopyofaprimarykeythatexistsinanotherentityforthepurposeofformingarelationshipbetweentheentitiesinvolved.第80頁,共114頁,2023年,2月20日,星期四EstablishtherelationshipsbetweentheentitiesArelationshipconnectstwoormoreentitysets.Itisrepresentedbyadiamond,withlinestoeachoftheentitysetsinvolved.第81頁,共114頁,2023年,2月20日,星期四E-R圖(續(xù))聯(lián)系聯(lián)系本身:用菱形表示,菱形框內(nèi)寫明聯(lián)系名,并用無向邊分別與有關(guān)實(shí)體連接起來,同時(shí)在無向邊旁標(biāo)上聯(lián)系的類型(1:1、1:n或m:n)聯(lián)系的屬性:聯(lián)系本身也是一種實(shí)體型,也可以有屬性。如果一個(gè)聯(lián)系具有屬性,則這些屬性也要用無向邊與該聯(lián)系連接起來

第82頁,共114頁,2023年,2月20日,星期四聯(lián)系的表示方法實(shí)體型1聯(lián)系名實(shí)體型2111:1聯(lián)系實(shí)體型1聯(lián)系名實(shí)體型2mnm:n聯(lián)系實(shí)體型1聯(lián)系名實(shí)體型21n1:n聯(lián)系第83頁,共114頁,2023年,2月20日,星期四聯(lián)系的表示方法(續(xù))實(shí)體型1聯(lián)系名mn同一實(shí)體型內(nèi)部的m:n聯(lián)系實(shí)體型1聯(lián)系名實(shí)體型21m多個(gè)實(shí)體型間的1:n聯(lián)系實(shí)體型3n第84頁,共114頁,2023年,2月20日,星期四聯(lián)系的表示方法示例班級(jí)班級(jí)-班長班長111:1聯(lián)系課程選修學(xué)生mnm:n聯(lián)系班級(jí)組成學(xué)生1n1:n聯(lián)系第85頁,共114頁,2023年,2月20日,星期四聯(lián)系的表示方法示例(續(xù))職工領(lǐng)導(dǎo)1n同一實(shí)體型內(nèi)部的1:n聯(lián)系課程講授教師1m多個(gè)實(shí)體型間的1:n聯(lián)系參考書n第86頁,共114頁,2023年,2月20日,星期四聯(lián)系屬性的表示方法課程選修學(xué)生mn成績第87頁,共114頁,2023年,2月20日,星期四ERDDevelopmentforaBeerBar?第88頁,共114頁,2023年,2月20日,星期四ExampleDrinkersaddrnameBeersmanfnameBarsnamelicenseaddrNote:license=beer,full,noneSellsBarssellsomebeers.LikesDrinkerslikesomebeers.FrequentsDrinkersfrequentsomebars.第89頁,共114頁,2023年,2月20日,星期四ERDDevelopmentforalibrary?第90頁,共114頁,2023年,2月20日,星期四同一實(shí)體集內(nèi)各實(shí)體間的聯(lián)系一對(duì)多聯(lián)系實(shí)例

職工實(shí)體集內(nèi)部具有領(lǐng)導(dǎo)與被領(lǐng)導(dǎo)的聯(lián)系某一職工(干部)“領(lǐng)導(dǎo)”若干名職工一個(gè)職工僅被另外一個(gè)職工直接領(lǐng)導(dǎo)這是一對(duì)多的聯(lián)系一對(duì)一聯(lián)系多對(duì)多聯(lián)系第91頁,共114頁,2023年,2月20日,星期四DataModelsAcollectionoftoolsfordescribingDataDatarelationshipsDatasemanticsDataconstraints第92頁,共114頁,2023年,2月20日,星期四DataModelsTypeRelationalmodelEntity-Relationshipdatamodel(mainlyfordatabasedesign)Object-baseddatamodels(Object-orientedandObject-relational)Semi-structureddatamodel(XML)Otheroldermodels:NetworkmodelHierarchicalmodel第93頁,共114頁,2023年,2月20日,星期四RelationalModelArelationaldatabaseisbasedontherelationalmodelandusesacollectionoftablestorepresentbothdataandrelationshipsamongthosedata.ExampleoftabulardataintherelationalmodelAttributes第94頁,共114頁,2023年,2月20日,星期四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第95頁,共114頁,2023年,2月20日,星期四ASampleRelationalDatabase第96頁,共114頁,2023年,2月20日,星期四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)第97頁,共114頁,2023年,2月20日,星期四DataManipulationLanguage(DML)Languageforaccessingandmanipulatingthedataorganizedbytheappropriatedatamodel.DMLalsoknownasquerylanguageRetrievalofinformationstoredinthedatabaseInsertionofnewinformationintothedatabseDeletionofinformationfromthedatabaseModificationofinformationstoredinthedatabaseTwoclassesoflanguagesProcedural–userspecifieswhatdataisrequiredandhowtogetthosedataDeclarative(nonprocedural)–userspecifieswhatdataisrequiredwithoutspecifyinghowtogetthosedataSQListhemostwidelyusedquerylanguage第98頁,共114頁,2023年,2月20日,星期四DataDefinitionLanguage(DDL)SpecificationnotationfordefiningthedatabaseschemaExample: createtable

account(

account-number

char(10),

balance

integer)DDLcompilergeneratesasetoftablesstoredinadatadictionaryDatadictionarycontainsmetadata(元數(shù)據(jù))(i.e.,dataaboutdata)DatabaseschemaDatastorageanddefinitionlanguageSpecifiesthestoragestructureandaccessmethodsusedIntegrityconstraintsDomainconstraintsReferentialintegrity(referencesconstraintinSQL)AssertionsAuthorization第99頁,共114頁,2023年,2月20日,星期四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第100頁,共114頁,2023年,2月20日,星期四DatabaseDesignTheprocessofdesigningthegeneralstructureofthedatabase:LogicalDesign

–Decidingonthedatabaseschema.Databasedesignrequiresthatwefinda“good”collectionofrelationschemas.Businessdecision

Whatattributesshouldwerecordinthedatabase?ComputerSciencedecision

–Whatrelationschemasshouldwehaveandhowshouldtheattributesbedistributedamongthevariousrelationschemas?PhysicalDesign

–Decidingonthephysicallayoutofthedatabase第101頁,共114頁,2023年,2月20日,星期四TheEntity-RelationshipModelModelsanenterpriseasacollectionofentities

andrelationshipsEntity:a“thing”or“object”intheenterprisethatisdistinguishablefromotherobjectsDescribedbyasetofattributesRelationship:anassociationamongseveralentitiesRepresenteddiagrammaticallybyanentity-relationshipdiagram:第102頁,共114頁,2023年,2月20日,星期四Object-RelationalDataModelsExtendtherelationaldatamodelbyincludingobjectorientationandconstructstodealwithaddeddatatypes.Allowattributesoftuplestohavecomplextypes,includingnon-atomicvaluessuchasnestedrelations.Preserverelationalfoundations,inparticularthedeclarativeaccesstodata,whileextendingmodelingpower.Provideupwardcompatibilitywithexistingrelationallanguages.第103頁,共114頁,2023年,2月20日,星期四XML:ExtensibleMarkupLanguageDefinedbytheWWWConsortium(W3C)OriginallyintendedasadocumentmarkuplanguagenotadatabaselanguageTheabilitytospecifynewtags,andtocreatenestedtagstructuresmadeXMLagreatwaytoexchangedata,notjustdocumentsXMLhasbecomethebasisforallnewgenerationdatainterchangeformats.Awidevarietyoftoolsisavailableforparsing,browsingandqueryingXMLdocuments/data第104頁,共114頁,2023年,2月20日,星期四StorageManagementStoragemanagerisaprogrammodulethatprovidestheinterfacebetweenthelow-leveldat

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論