收藏 分享(赏)

数据库52986.ppt

上传人:dreamzhangning 文档编号:3316542 上传时间:2018-10-12 格式:PPT 页数:39 大小:215KB
下载 相关 举报
数据库52986.ppt_第1页
第1页 / 共39页
数据库52986.ppt_第2页
第2页 / 共39页
数据库52986.ppt_第3页
第3页 / 共39页
数据库52986.ppt_第4页
第4页 / 共39页
数据库52986.ppt_第5页
第5页 / 共39页
点击查看更多>>
资源描述

1、1,2008年春季软件学院课程,DATABASE Principles, Programming, and Performance,西安电子科技大学软件工程研究所 李雁妮 Email: ,2,绪 论,当今,没有哪一个领域比计算机科学技术变化更快、更具有挑 战性。数据库技术是计算机科学技术中发展最快的领域之一,也是 应用最广的技术之一,它已成为计算机信息系统与应用系统的核心 技术和重要基础。当今,Internet技术的迅猛发展,更是对数据库 技术的重要性进行了简单的放大。,3,绪 论,1. 什么是数据(data)? 描述事物的符号记录称之为数据。 数据有各种形式(如文字、图形、图像等),它们都可

2、以经过数字化存入计算机。 数据的形式不能完全表达其内容,需要经过解释。所以数据和关于数据的解释是不可分的,数据的解释是指对数据含义的说明,数据的含义称为数据的语义,数据与其语义是不可分的。 Ex. (王明,男,21,计算机学院,99) 2. 什么是数据库(database)? 数据库即存放数据的仓库。 该仓库(一般)建立在计算机存储设备上,并且库中的数据是按一定的格式存放的。,4,绪 论,3. 数据库发展史数据库技术是顺应数据管理任务的需要而产生的。数据处理指对各种数据进行收集、存储、加工和传播的一系列活动的总和。数据管理指对数据进行分类、组织、编码、存储、检索和维护,它是数据处理的核心问题。

3、数据管理技术经历了三个发展阶段:人工管理、文件系统、数据 库系统。 从其发展史,我们可理解当今数据库的一般特征及数据 库系统关注并解决了哪些问题.,5,绪 论,1) 人工管理阶段时间:20世纪50年代中期以前。背景: 应用主要用于科学计算 硬件无直接存取存储设备(如磁盘) 软件无OS (Operating System) 处理方式批处理人工管理数据的特点: 数据不保存(应用程序不需要长久保留) 应用程序管理数据(应用程序不仅要规定数据的逻辑结构,而且要设计数据的 物理结构,包括存储结构、存取方法、输入方式等) 数据不共享,一般而言,一组数据只能对应一个应用程序数据不具有独立性 数据的逻辑结构或

4、物理结构发生变化后,必须对应用程序做相应的修改。,6,绪 论,图1 应用程序与数据集之间的关系,7,绪 论,2) 文件系统时间:20世纪50年代后期60年代中期 ,已有文件系统、磁盘等。优点: 数据可长期保存 由文件系统管理数据缺点:数据是分离的和独立的;数据经常是重复的(数据冗余)应用程序依赖于文件格式文件处理系统中,文件和记录的物理格式通常是应用程序代码的一部分。 文件相互之间经常是不兼容的文件的格式依赖于产生它们的语言或产品,这样文件不便于比较和合并 很难以用户希望的形式表示数据,8,绪 论,3) 数据库系统数据库技术的发展主要是用来克服文件处理系统的上述限制。图3 用户、数据库应用程序

5、、DBMS和数据库之间的关系,DBMS,9,绪 论,数据库系统(DBMS)和文件系统相比,其根本差异在于:应用程序是通过DBMS来访问数据库。应用程序员无需关心数据库中数据 的物理存储形式,对数据的操作是一种透明方式,这使得他们可将注意力集中在 重要的事情上。主要特点:集成的数据(数据库中的数据是针对系统中的所有应用)较少的数据重复(冗余)程序/数据独立性(program/data independence) 数据由DBMS负责易于表示用户的视图,10,绪 论,4. 数据库定义 数据库(database, DB)是指自描述的完整记录的集合。 数据库是自描述的:它除了包含用户的源数据外,还包含关

6、于它本身结构的描述(数据字典,亦称为元数据) 数据库是集成记录的集合源数据;元数据;索引;数据库应用程序的(特定)数据。 数据库是用户模型的模型,11,绪 论,5. 教材特征和内容教材特征: 从理论和实践两方面对数据库理论、应用、设计和编程均做了严谨的表述。 该版为修订版,反映了6年来数据库领域总体的进步和发展动态,书中重点讲述了对象关系模型(Object-Relational Models); 介绍了一些系统(如Oracle、DB2和Informix等)中通用的新概念; 介绍了SQL-99设计方法及与之相关的原理、方法及主要产品。教材主要内容:关系理论数据库设计数据库编程及运行转储结果等,1

7、2,绪 论,6. 本课程的目标掌握数据库理论的基本原理 能利用掌握的基本原理进行一般数据库的设计和进行数据库应用程序的开发 了解影响数据库性能指标的因素,对如何改善/提高数据库的性能有一定的理论知识并具有相应的策略7. 学习方法用心+责任精深胜于博大!实践、认识、再实践、再认识!,13,1. Introduction,Topic: This chapter introduces the central ideas and definitions coveredin the text.1.1 Fundamental Database ConceptsDBMS(a database managem

8、ent systemor, simply a database system)is a program product for keeping computerized records about an enterprise.DBMS是位于用户与操作系统之间的一层数据管理软件。,14,1. Introduction,硬件,编译系统,应用开发工具,应用程序,图 数据库在计算机系统中的地位,15,1. Introduction,DBMS的功能: 数据定义的功能(Data Definition LanguageDDL)。利用DDL可方便地对数据库中的数据对象进行定义。 数据操纵功能(Data Man

9、ipulation LanguageDML)。 用户利用DML实现对数据库数据的基本操作,如查询、插入、删除和修改等。 数据库的运行管理。在数据库的建立、运行和维护时,由DBMS进行统一管理、统一控制,以确保数据的安全性、完整性、多用户的并发操作及发生故障后的系统恢复。 数据库的建立及维护。数据库初始数据的录入、转换功能、数据库的转储、恢复功能、数据库的重组织和性能监视、分析功能等。一般由DBMS中的一些实用程序完成。,16,1. Introduction,DatabaseThe collection of records kept for a common purpose. 数据库中的数据是

10、长期存储在计算机中的,按一定的数据模型组织、描述和储存。它具有较小的冗余度,较高的数据独立性和易扩展性,并可为多个各种用户共享。 The records of the database normally reside on disk, and the records are normally retrieved from disk into computer memory only when they are accessed.,17,1. Introduction,History of Database Systems(数据模型的发展史) A number of different appr

11、oaches have been developed for structuring access to information in a database. 数据模型(data model )按计算机系统的观点对数据库中的数据建立的模型。 每种DBMS都是基于某种特定的数据模型。,18,1. Introduction,数据库领域中的五种数据模型(相对于结构化的数据): 层次模型; 网状模型; 关系模型; 面向对象模型; 对象-关系模型。 一个数据模型完整地描述了: 数据结构 刻画了模型性质最本质的方面 数据操作 完整性约束条件,非关系模型,关系型,19,1. Introduction,1)

12、IBMs IMS (Information Management System), released in 1968IMS provided the hierarchical data model, where different kinds of records relate to one another in a hierarchical form. (树),定义:有且只有一个结点没有双亲结点,该结点为根结点;(结点为记录)根以外的其他结点有且仅有一个双亲结点。,20,1. Introduction,层次模型的基本特点: 任何给定的记录值只有按其路径查看时,才能显示出它的全部意义,没有一个

13、子女记录值能够脱离双亲记录值而独立存在;只能处理一对多的实体关系。,21,1. Introduction,2) Cullinet Softwares IDMS, released in early 1970s. network data model. IDMS根据CODASYL系统实现。 Charles Bachman 1973年获图灵奖 CODASYL (conference On Data System Language数据系统语言研究会)下属的数据库任务组(Data Base Task Group-DBTG)于70年代提出的一个系统方案, 它并非一个实际的系统,但提出了一些理念、方法和技

14、术,对网状数据库的研制和发展起了重大的影响。 The network data model, a generalization of the hierarchical model where a set of record in one layer might have two different containing hierarchies at the next layer up. (无环图),22,1. Introduction,优点:能较真实地模拟客观世界,实现多对多的关系。 The main drawback with these products was that queries

15、against the data were difficult to pose and execute, normally requiring a program written by an expert programmer who understood what could be a complex navigational structure of the dada. (存储及导航的复杂化),23,1. Introduction,3) The Relation and Object-Relational Models 1970,IBM公司San Jose研究室的研究员 E.F.Codd创

16、建。1981年获图灵奖 Relational model 基于严格的数学基础(关系代数) Relational model数据的逻辑结构是一张二维表. Relational DBMS(RDBMS)A DBMS that utilizes the relation model. Object-relational model表中的某些属性(Attribute)是对象(表中有表), 称为ORDBMS 由于对象-关系模型是关系模型的进化,故对象关系模型向下兼容关系模型。,24,1. Introduction,A Relational Database Example In a relational

17、database, all information is represented in the form of named tables (relation) with the form of named tables with labeled column(attribute).关系模型应遵循第一范式规则(first normal form rule):In the relational model, a column of a table must contain a single, unstructured value. (表中不能有表),25,1. Introduction,Stude

18、nts,The relational model is sometimes described as being a “fill-in-the-form, one- fact-in-one-place” model。,26,1. Introduction,An Object-Relational Database ExampleIn an object-relational database, information is still represented as in the relational model in the form of named tables with labeled

19、columns, but the column values are no longer restricted by the first normal form rule.In object-relational database, we drop the “one-fact-in-one place” limitation。例:P5图1.1b,27,1. Introduction,About structured typeORACALobject typeINFORMIXrow typeDB2 UDBuser-defined type(or UDT) ANSI SQL-99collectio

20、n type,28,1. Introduction,1.2 Database Users End usersInteractive usersCasual users (临时用户)Naive users (初级用户) Application programmers. An application programmer, in the sense used with DBMS, writes the menu applications used by naive users. DBA (database administrator). A DBA is a computer profession

21、al responsible for the design and maintenance of the database.,29,1. Introduction,The responsibilities of DBA Decides how the data will be broken down into tables; Creates the database; Loads the tables, and performs a large number of behind-the scenes tasks to implement various policies about data

22、access and update.policies:Security(e.g., which users are empowered(授权) to access what data)Integrity constraints(完整性约束) Responsible for the physical layout of the database on secondary storage; Index structures to achieve best performance.,30,1. Introduction,1.3 Overview of Relational and Object-Re

23、lational DBMS Chapter 2: The Relational Model we characterize(刻画) the relational model from a different aspect, the standard query power inherent in the relational algebra. Relational algebra is not available to answer computerized queries on commercial DBMS products, which provide the SQL language

24、for that purpose. However, the relational algebra has a virtue(功效) when compared with relational SQL. It has only a small number of operations, and they are extremely simple to describe and transparent in their effect. 关系代数是一种抽象的查询语言,是关系数据操纵语言的一种传统表达方式,它是用对关系的运算来表达查询的。 用关系代数表达的查询和SQL查询语句有相应的映射。,31,1

25、. Introduction,Chapter 3: Basic SQL Query Language SQL (The industry sandard relational query language). James Gray, SQL之父,1998年获图灵奖。 We provide something we call a Basic SQL syntax for features that have been adopted by all major relational products and an Advanced SQL syntax for features that are

26、not yet generally adopted. Chapter 4: The Object-Relational Model In Chapter 4, we introduce the features of the object-relational model in detail, starting with the new user-defined types to allow us to create tables.,32,1. Introduction,Chapter 5: Programs to Access a Database Embedded SQL programm

27、ing preprocessorturned into valid calls to C functions in the database function libraryC compiler produces a working program。 Program-data independence 程序数据独立性 (DEFINITION) data independence is a feature of a properly constructed database that makes application logic immune to(免疫于) changes in storag

28、e structure and access methods. The value of program-data independence becomes particularly apparent as changes in table structure occur with the passage of time.,33,1. Introduction,Chapter 6: Database Design Logical database design深入分析数据集,建模,最终数据用关系数据库表示,并制定完整性约束(Integrity constraints)等规则。 建模过程: 将现

29、实世界抽象成概念模型(Entity-Relationship Approach, E-R图) P15页图1.9 根据概念模型转化为具体的DBMS所支持的数据模型,34,1. Introduction,Chapter 7: Integrity, View, Security, and Catalogs IntegrityThese are rules that are considered important for the database to obey at all times. It can be classified into three classes: 实体完整性(Entity I

30、ntegrity) 参照完整性(Referential Integrity) 用户自定义的完整性(User-defined Integrity) Centralized Control of Data(表的join) and Database Security(Grant语句) data redundancy(数据冗余 duplication of data) Database Views. 数据库视图是一个或几个基本表(视图) 导出的表, 它是一个虚表。数据库中只存放视图的定义,而不存放视图对应的数据,这些数据仍存放在原来的基本表中 。,35,1. Introduction,Chapter

31、8: Indexing Physical database designdecide how base tables are to be laid out on disk, and what indexes should be created to optimize access to the data required by the applications and ad hoc uses at the installation. Indexing提高数据库的(查询)性能 Chapter 8 explores design options, discussing data storage a

32、nd indexing issues in relation to actual database systems.,36,1. Introduction,Chapter 9: Query Processing In Chapter 9, we investigate the concept of query optimization, a process performed by the database system。Chapter 10: Update Transaction When updates are performed on a database, we need some w

33、ay to guarantee that database a set of updates will succeed all at once or not at all. Transaction用户定义的一个数据库操作序列,这些操作要么全做,要么全不做,是一个不可分割的工作单位.,37,1. Introduction,OLTPonline transaction processing。(使编写的应用程序能处理更新操作同时进行的情况。) The underlying theoretical concept of concurrency in transactional systems. Per

34、formance considerations in transactional processing.Chapter 11: Parallel and Distributed Database 并行和分布式数据库是数据库技术和网络技术两者相互渗透和有机结合的结果。该章介绍了并行和分布式数据库的基本概念、特点、分布处理等一些问题。,38,学习本教材导图,39,本章要点,数据库即存放数据的仓库。该仓库(一般)建立在计算机存储设备上,并且库中的数据是按一定的格式存放的。数据库系统DBMS经历了五个发展阶段:层次、网状、关系、面向对象、对象关系模型。数据库系统是由应用驱动,顺应计算机技术的发展而发展起来的。本章介绍了数据库(系统)的一些基本概念和定义,这些概念是理解和学习数据库理论的重要基础。,

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高等教育 > 大学课件

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报