27
Yunsheng Liu Yunsheng Liu 2008.9 2008.9 软软软软

Yunsheng Liu 2008.9

  • Upload
    dore

  • View
    32

  • Download
    0

Embed Size (px)

DESCRIPTION

II. Fundamentals of. Database Systems. Yunsheng Liu 2008.9. 软件学院. (1). Data are (or believed to be) facts or ideas which result from the observation of physical phenomena. (2) . Data are symbols for information presentation - PowerPoint PPT Presentation

Citation preview

Page 1: Yunsheng Liu 2008.9

Yunsheng LiuYunsheng Liu

2008.92008.9

Yunsheng LiuYunsheng Liu

2008.92008.9

软件学院软件学院

Page 2: Yunsheng Liu 2008.9

Yunsheng Liu-DBS 2

2.1 Data and Their Representation2.1 Data and Their Representation

2.1.1 Data and Information2.1.1 Data and Information

(1). Data are (or believed to be) facts or ideas which result from the observation of physical phenomena.

(2). Data are symbols for information presentation - It can be recorded, communicated and identified - The symbols can be different in styles formats media(3). Data describe attributes of entities, events and transactions.

1. Data

Page 3: Yunsheng Liu 2008.9

Yunsheng Liu-DBS 3

2. Information - Information is processed and refined data which is used in decision making.3. Data vs. Information (1). Information is made up of two parts: data context (2). Sometimes, they are exchangeable to use (3). Relations and differences

2.1.1 Data and Information2.1.1 Data and Information

4. Knowledge

Page 4: Yunsheng Liu 2008.9

Yunsheng Liu-DBS 4

“ 天 将下 雨 ”

“ 天气是闷热而潮湿的, 天将下雨 ” Causal relation

“ 天气 闷热 潮湿的 ”

data(ideas)

context

data(factors)

Examples:

information

Knowledge

2.1.1 Data and Information2.1.1 Data and Information

“ 是 而 ”

“ 如果 则 ”

Page 5: Yunsheng Liu 2008.9

Yunsheng Liu-DBS 5

2.1.2 Data Representations2.1.2 Data Representations

- The use of a DBS is ultimately concerned with some real-word enterprise, and the data to be stored describes various aspects of this enterprise.

1. Three realms: Real-world, Data/information-world Computer-world

Page 6: Yunsheng Liu 2008.9

Yunsheng Liu-DBS 6

Real World

Info. World

Observing

Understanding Strategies, Rules

Representing

Expiaining

ExtractingRelating

OperatingOperating Physical Phenomena

Physical Phenomena

KNOW.KNOW.

CP. World DATADATA

INFOR.INFOR.

Relationships among the three worlds

Page 7: Yunsheng Liu 2008.9

Yunsheng Liu-DBS 7

2. Types vs. occurrences of data

Student# S-Name Sex Birthday Dept.

2008101001 Wei Liu M 1990-10-01 SW

… … … … …

The Type of STDUDENTSTUDENT

An occurrence of

STDUDENT

3. Entities - An entity is a thing/object in the RW which exists and is

distinguishable from any others

2.1.2 Data Representations2.1.2 Data Representations

— objective or subjective

Page 8: Yunsheng Liu 2008.9

Yunsheng Liu-DBS 8

2.1.3 Relationships Between Data 2.1.3 Relationships Between Data

1. Relationships between data items Represanting semantic dependencies between data items Used to aggregate the related data items into entities The types:

Dept# D-Name1 : 1

D-Name Phone1 : M

S-Name C-NameM : N

Page 9: Yunsheng Liu 2008.9

Yunsheng Liu-DBS 9

2. Relationships between record types Concept—representing semantic relations between two entity sets/classes Purpose—modeling the relations among entity types Semantic notions: e.g.

StudentStudent

CourseCourse

interactionStudentStudent

GraduateGraduate

generalization/specification

ClassClass

StudentStudent

grouping …

2.1.3 Relationships Between Data 2.1.3 Relationships Between Data

Page 10: Yunsheng Liu 2008.9

Yunsheng Liu-DBS 10

3. Relationship types between record types

- Defined by the numbers of record occurrences for each record type to appear in a rerlationship

Student Bicycle1 : 1

Class StudentStudent1 : M

StudentStudent CourseCourseM : N

2.1.3 Relationships Between Data 2.1.3 Relationships Between Data

Page 11: Yunsheng Liu 2008.9

Yunsheng Liu-DBS 11

2.2 Data Views2.2 Data Views

1. Abstraction at physical level - Describing physical data structure while hiding

storage device properties and operational details 2. Abstraction at conceptual/logical level - Describing total logical data structure while hiding

physical structures and Implementation details 3. Abstraction at user level - Describing local logical data structures for various

users while hiding total structure complexity and details

2.2.1 Hierarchical Data Abstractions

幻灯片 16

Page 12: Yunsheng Liu 2008.9

Yunsheng Liu-DBS 12

2.2.2 Hierarchical Data Views 2.2.2 Hierarchical Data Views

1. End-user views —I/O formats

2. Applications views —local logical structures

3. System view —total logical structure

4. Storage view —storage structure

5. Physical view —physically organizing structure on a storage device

幻灯片 16

- Various data structures observed by different kinds of users taking different stands on and with different viewpoints

Page 13: Yunsheng Liu 2008.9

Yunsheng Liu-DBS 13

1. Subschemas / External schema

2.2.3. Database Schemas

A formal specification of a local logical structure of a DB used by a user/application

There are many subschemas for a DB

Schema vs. instance Type vs. occurrence

A formal specification of a database structures (design or plan) in the DDL of a DBMS

Page 14: Yunsheng Liu 2008.9

Yunsheng Liu-DBS 14

3. Stored/Internal schema

2. Conceptual/Logical schemaA formal specification of a total logical structure of a

entire DB. A schema is an integration of all the subschemas. Each subschema can be derived from the conceptual

schema and permitted to have some differences

A formal specification of a total physical structure or file organization of an entire DB.

2.2.3. Database Schemas

幻灯片 16

Page 15: Yunsheng Liu 2008.9

Yunsheng Liu-DBS 15

2.2.4 Independencies of Data2.2.4 Independencies of Data

1. Physical data independence

- The physical schema can be changed without altering the conceptual schema or redefining subschemas and in turn rewriting application programs

2. Logical data independence

- The conceptual schema can be modified without affecting application programs

幻灯片 16

Data independence means that a data specification is separated( independent) from its use( program).

There are two kinds of data independences:

Page 16: Yunsheng Liu 2008.9

Yunsheng Liu-DBS 16

Conceptualschema

Storedschema

Physical DB

Subschema 1 Subschema 2 Subschema n

xyz… xyz… I/O

view

Appli view

System view

Stored view

Physical view

Database System Hierarchy

2.2 H-Abstrac 2.2.2 Hierarchical Data Views

Logical Data Independency

Physical Data Independency

幻灯片 15

physical level Abstraction

Conceptual level Abstraction

User level Abstraction

Page 17: Yunsheng Liu 2008.9

Yunsheng Liu-DBS 17

2.3 Introduction to Data Models 2.3 Introduction to Data Models

1. Model concept A model is an abstract representation of a “system” in mathematics Two basic types of models: structural and procedural Models are of abstractions at different levels

2. Data model concept A DM is a model to describe (the data of ) a DB Two kinds: DBS-oriented, e.g. HM, NM, RM, etc.

Area-oriented, e.g. E-RM Database DM vs. DB schema –– related & different

Page 18: Yunsheng Liu 2008.9

Yunsheng Liu-DBS 18

3. Three classical data models

Hierarchical model

Network model

Relational model

4. Semantic data models

E-R, the 1th SDM Function model, Role model, Type model, etc.

2.3 Introduction to Data Models 2.3 Introduction to Data Models

Page 19: Yunsheng Liu 2008.9

Yunsheng Liu-DBS 19

2.4 Database Languages2.4 Database Languages

1. Introduction

Syntax — language text

Processing — Compiler system

Two kinds of capabilities:

Algebraic operating—as a general programming language,

Accesses to a DB

Page 20: Yunsheng Liu 2008.9

Yunsheng Liu-DBS 20

3. DBCL — Database control language

4. HL — Host Language, a programming language within which DML statements can be embedded

2. Data language

DDL — Data definition/description language

DML — Data manipulation language

QL — Query language

2.4 Database Languages2.4 Database Languages

Page 21: Yunsheng Liu 2008.9

Yunsheng Liu-DBS 21

5. The language utilization

2.4 Database Languages2.4 Database Languages

Program variablesProgram variables

HL variables

Hostvariables

DMLPre-compiler

DMLPre-compiler

HLCompiler

HLCompiler

DB

ApplicationApplication

HLstatements

DMLstatements

DBMSDBMS

Page 22: Yunsheng Liu 2008.9

Yunsheng Liu-DBS 22

2.5 Database Organization2.5 Database Organization

Hierarchy of DB Organization

Type Occurrence

Schema, Subschemas DB

Entity type/set, Record type, File 、 Relation 、 Data set Relation schema Page, Block

Entity, Record, Tuple

Field, Attribute, Data item Value

Page 23: Yunsheng Liu 2008.9

Yunsheng Liu-DBS 23

2.6 Queries2.6 Queries The essential purpose to develop a DB is for

conveniently utilizing the DB Two kinds of operations: query and maintenance

and a query is more complex than others Query processing includes:

Q specification in QL physical DB operations Optimizations Execution

It has a heavy influence on the performance of the system

Page 24: Yunsheng Liu 2008.9

Yunsheng Liu-DBS 24

2.7 Transaction Management2.7 Transaction Management

- Transaction Management is the core and key issue

of a DBS Admission Resource management: CPU, I/O and buffer, data Consistency maintenance Execution control Recovery management

Page 25: Yunsheng Liu 2008.9

Yunsheng Liu-DBS 25

2.8 Database Users2.8 Database Users

End-users Occasional Repeat-based IP professionals

Operators Application programmers Database Administrators/Developer System programmers

Supporting for

1. User types1. User types

Page 26: Yunsheng Liu 2008.9

Yunsheng Liu-DBS 26

DBAApp-pmer

Sys-admerSys-pmer

Operator

End-user

2. The Relationships among users2. The Relationships among users

Page 27: Yunsheng Liu 2008.9

Yunsheng Liu-DBS 27

2.9 Database System Architecture 2.9 Database System Architecture

Transaction Processing

Q Processing

DD/D Mgt.

DD/D

Data Manipulating

Stored Data Mgt.

Compiling

DBA/DUsers 1

L Processing

Data processing

Data mgt.

DBData files Indexes

DBsDBs

UsersUsers

OSOS

DBMSDBMSQueriesApplications (DML+HL) Schemas Interfaces

DDL Interpreting

Users 2