chaper1- the_world_of_database_systems
Download
Report
Transcript chaper1- the_world_of_database_systems
An Introduction to
Database System
College of Computer Science and Technology
Chongqing University of Posts & Telecom.
Spring, 2008
Course Information
• Teacher: 王晓蓉
• Email: [email protected] (best way to
reach me)
– Tel:13368025670
• Class web page:
– http://cs.cqupt.edu.cn/database
2/33
Textbooks
• Required:
– A First Course in Database Systems
(second edition), by Jeffrey D.Ullman
Jennifer Widom.
• Recommended:
– 萨师煊, 王珊. 数据库系统概论(第三版).
高等教育出版社, 2000 年
– Books on SQL Server 2000
• You may also want:
– Books on design and programming :
Powerbuilder, PowerDesigner, UML,
VB, Delphi, VC, JAVA, C#, ASP, PHP,
JSP etc.
3/33
Syllabus(提纲)
• Background and history of database
management systems
• Fundamentals of using a database management
systems: SQL 2000.(*extracurricular(课外了
解))
• Database modeling(数据模型)
• Relational model: theoretical background and
operations (关系模型)
• Database Language SQL
• Fundamentals of database management systems:
transactions(事务) and security etc.
• Database system design and practice
4/33
Chapter 1
The Worlds of Database Systems
•Evolution of Database Systems
•Architecture of DBMS and DBS
•Future of Database Systems
1.1 Evolution of Database Systems
1.1.1 Some Basic notions
– Data
– Database (DB)
– Database Management System (DBMS)
– Database System (DBS).
– Database Administrator (DBA)
6/33
Basic Notions
• Data
– Distinct pieces of information represented in a form
suitable for processing by computer.
– Data can exist in a variety of forms -- as digital
numbers, text, image, sound, video and etc.
• Database (DB)
– In essence, it’s nothing more than a collection of
information that exists over a long period of time.
– In common parlance, it refers to a collection of data
managed by a database management system (DBMS)
or just database system (DBS).
7/33
Example of Data and Database
• Data
– Record of student archive
(李明,男,1972,江苏,计算机系,1990)
• Database (DB)
学生登记表
学
号
姓
名
年
龄
性
别
系
名
年
级
95004
王小明
19
女
社会学
95
95006
黄大鹏
20
男
商品学
95
95008
张文斌
18
女
法律学
95
…
…
…
…
…
…
8/33
DBMS
• Database Management System (DBMS)
– A collection of programs that enables you to
store, modify, and extract information from a
database.
– There are many different types of DBMSs,
ranging from small systems that run on
personal computers to huge systems that run
on mainframes.
9/33
Basic functions of DBMS
• Data definition(数据定义)
– Allow creating new databases and specify their schema (logical
structure of the data), via data definition language (DDL).
• Data manipulation(数据操作)
– Allow efficient access to the data, such as querying and
modifying the data, via query language or data manipulation
language (DML).
• Operation management of DB
– Support the storage of very large amounts of data over a long
period of time, assuring data integrity, keeping data secure from
accident or unauthorized use. Support concurrent, atomic
access to data. (Example: bank and its ATM machines.)
• Creation and maintenance of DB
– Such as inputting and transferring of Data, DB backup and
recovery, performance monitoring, audit and analysis etc.
P1
Reading book
10/33
Database System (DBS)
• Database System (DBS).
– DB, DBMS, Development Tools, DB applications, DB
Administrator (DBA) and users
User
User
Application Systems
DB applications
Developing Tools
Developing Tools
DBMS, Compiling System
Operating System
DBMS
DBA
Hardware
OS
DBMS in Computer System
DB
11/33
Database Users
• 用户(Database Users)可以按照使用系
统的不同方式进行区分
– 复杂用户
• 可直接使用查询语言的技术人员
• 专家用户:可根据需要编写特定的数据库应用程序
– 简单用户
• 使用编制好的应用程序访问数据库
• 如银行的职员、机票预定人员、旅馆总台服务员
– 偶然用户
• 企业或组织机构的高中级管理人员
12/33
Database Administrator
• DBA
– Person who is responsible for management
and maintenance of DB.
• 具体任务
– 决定数据库中信息内容和结构
– 存储结构和存取方式定义
– 定义数据的安全性和完整性约束条件
– 改进和重构数据库系统
– 监控数据库的使用和运行
13/33
其它人员
• 系统分析员
– 负责应用系统的需求分析和规范说明
– 与用户及DBA协商,确定系统的硬软件配置
– 参与数据库系统的概要设计
• 数据库设计人员
– 参加用户需求调查和系统分析
– 确定数据库中的数据
– 设计数据库各级模式
• 应用程序员
– 设计和编写应用系统的程序模块
– 进行调试和安装
14/33
问题
• 在一个大公司的工资单系统中,指出哪些
类型的用户执行以下功能?
– a.编写一个应用程序以生成和打印帐单
– b.改变一个已搬家的员工在数据库中的地址
– c.为一个新职工的工资单创建一个新的用户帐
号
应用程序员
用户
DBA
15/33
Data
• 数据是DBMS的核心
• 两类数据
– 显然数据
• 所需数据集合
– 元数据(metadata)
• 关于数据库的信息,通常保存在数据字典或目录中
• 数据字典中的信息包括与用户、权限和数据库内部
的结构有关的信息
16/33
1.1.2 History of Data management
• File systems
– Problems: limited support to definition of data schema,
no directly support to DML (Data Manipulate Language),
no support to efficient concurrent, secure access etc.
• Early DBMS
– The first commercial DBMS appeared in the late 1960’s,
evolved from file systems.
– The early DBMS’s used several data models for
describing structure of DB: hierarchical model and
network model.
– Problems: no support to high-level query languages.
17/33
P2
History of Data management (cont.)
• Relational DBMS
– A famous paper by Ted Codd in 1970, “A relational
model for large shared data banks” in Comm. ACM.
– Data organized as tables called relations.
– Unlike the user of early DBS, user of a relational
system won’t be concerned with the storage structure,
and queries are expressed in a very high-level
language (SQL).
– Today used in most DBMS's.
18/33
P4
Relational Model
• Based on tables, such as:
Tuples
(rows)
acct #
12345
34567
…
name
Sally
Sue
…
Attributes
(column headers)
balance
1000.21
285.48
…
19/33
P4
Query Languages
Employee
Name
Dept
Department
Dept
Manager
SELECT Manager
FROM Employee, Department
WHERE Employee.name = "Clark Kent”
AND Employee.Dept = Department.Dept ;
20/33
History of Data Model
• Data model:
– abstraction of data features in real world into computer world.
60’s
Hierarchical model
Network model
70's
80's
Relational model
Choice for most new
applications
90’s
Object Bases model
Knowledge Bases model
now
21/33
P3
Relational model or not?
• Relational model is good for:
– Large amounts of data —> simple operations
– Navigate among small number of relations
• Difficult Applications for relational model:
– VLSI Design (CAD in general)
– CASE: Computer-Aided Software Engineering
– Graphical Data
• Where number of "relations" is large,
relationships are complex
– Object Data Model
– Logic Data Model
22/33
Other Data Models
• Object data model
– Usually find objects via explicit navigation,
also query language in some systems
• Complex Objects – Nested Structure (pointers or
references)
• Encapsulation, set of Methods/Access functions
• Object Identity
• Inheritance – Defining new classes like old classes
• Logic data model
– Prolog, Datalog
– More power than relational
23/33
The DBMS Marketplace
• Relational DBMS companies – Oracle, Sybase – are among
the largest software companies in the world.
• IBM offers its relational DB2 system. With IMS, a
nonrelational system, IBM is by some accounts the largest
DBMS vendor in the world.
• Microsoft offers SQL-Server, plus Microsoft Access for the
cheap DBMS on the desktop, answered by “lite” systems
from other competitors.
• Relational companies also challenged by “object-oriented
DB” companies.
• But countered with “object-relational” systems, which retain
the relational core while allowing type extension as in OO
systems.
24/33
1.2 Architecture of DBMS
• Major components of a DBMS
Schema
Modifications
Queries
Modifications
Query Processor
Transaction
Manager
Storage Manager
Data
Metadata
Schema (logical structure of the data); Metadata(data of data)
25/33
Architecture of DBS
Three Schema Architecture of DBS
• External Schema: user schema or subschema
– Defines one view of the data as seen by a specific set of
application or end users.
– There may be many external schemas in a DB.
• Schema: conceptual schema, logical schema
– Defines data from perspective systems designer;
– Independent of end users & data storage mechanism
– There is only one conceptual schema in a DB.
• Internal Schema: storage schema
– Defines how data is organized, stored and manipulated inside
the system.
– Totally dependent on particular implementation.
– There is only one internal schema in a DB.
26/33
Three Schema Architecture (cont.)
ApplicationApplication Application Application Application
A
B
C
D
E
External
Schema 1
External
Schema 2
External
Schema 3
Schema
Internal
Schema
DB
27/33
Independence of Data and Program
• Logical Independence
– Via Reflection of External Schema/Schema
– One Schema corresponds to many External schemas;
every Ex-Schema has an Ex-Schema/Schema
Reflection.
– When Schema changes, DBA changes the ExSchema/Schema reflections, so application programs
needn’t been changed.
• Physical Independence
– Via Reflection of Schema/Internal Schema
– Schema/Internal Schema Reflection is unique.
– When Internal Schema changes, DBA changes the
Schema/ Internal Schema Reflection, so application
programs needn’t been changed.
28/33
各种人员的数据视图
用户
数据表示
应用系统
应用程序员
外模式
模式
DBMS
DBA,
系统分析员
内模式
OS
DB
数据抽象级别
软件系统层次
29/33
Three Aspects to Studying DBMS's
• Modeling and design of databases.
– Allows exploration of issues before
committing to an implementation.
• Programming
– SQL: queries and DB operations like update.
– Host language and Embedded SQL
• DBMS implementation
30/33
Host Languages
• Host language is completely general (Turing complete)
but gives you no support.
• Query language—less general, "non procedural" and
optimizable.
Application program
Calls to DB
DBMS
Local Vars
(Memory)
(Storage)
C, C++, Fortran, Java, Delphi, VB etc.
31/33
Reading Guide
• A First Course in Database Systems:
– Required: 1.1, 1.2
– Recommended: 1.3
• 数据库系统概论
– 推荐:第一章
32/33
Exercises
• (Required, in English) Explain the following notions and
give an example to show them clearly.
– DB, DBMS, DBS
以下选做:
• (推荐作业,中文完成) 逻辑独立性和物理独立性是什么含
义?在数据库系统架构中是如何保证这两个独立性的?
• (建议作业,中文完成) 对数据库技术发展趋势、主流数据
库产品、流行数据库开发和设计技术进行调研,撰写小论
文,和同学分组讨论。
http://www.google.com
33/33