wei-pang yang, information management, ndhu 0-1 database systems overview 國立東華大學...

41
Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS DATABASE SYSTEMS OVERVIEW 國國國國國國 國國國國國 國國國 教教

Upload: aron-patrick

Post on 11-Jan-2016

228 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-1

DATABASE SYSTEMSDATABASE SYSTEMS

OVERVIEW

國立東華大學資訊管理系

楊維邦 教授

Page 2: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-2

Database System: Introduction

Database Management System (DBMS) Contains a large bodies of information

Collection of interrelated data (database)

Set of programs to access the data

Goal of a DBMS: provides a way to store and retrieve database information

• convenient and

• efficient

Page 3: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-3

Database System: Introduction (cont.)

Functions of DBMS: Management of Data (MOD) Defining structure for storage data

Proving mechanisms for manipulation of data

Ensure safety of data (system crashes, unauthorized access, misused, …)

Concurrent control in multi-user environment

Computer Scientists: Developed a lot of concepts and techniques for MOD

Concepts and techniques form the focus of this course

Page 4: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-4

Introduction

Why Database Systems?

An Architecture for a Database System

Data Models

Components of a Database System

How to establish a Database System?

Discussion and Remarks

Extending Database Technology

Data Structure and Database 課程流程圖 Research on Database

Contents

Page 5: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-5

Conventional Data Processing techniques:

Enterprise:

ApplicationSystem A

Application Program A

File System A Customer

ApplicationSystem B

Application Program B

File System B Invoice

ApplicationSystem N

ApplicationProgram N File System N Inventory

0.1 Why Database Systems?

Page 6: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-6

Customer Invoice

Inventory Parts

Customer No.

Customer Name

Customer Addr.

Social Security ID

Customer No.Customer NamePart No.QuantitiesUnit Price

Part No.Part Description Unit Price SupplierQuantities RemainQuantities Ordered

Part No.Part DescriptionSupplierQuantities OrderedCustomer NameUnit Price

0.1 Why Database Systems? File System

Page 7: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-7

0.1 Why Database Systems? File System: Advantages and Disadvantages

Advantages: File Systems are simple in design

Disadvantages:• Data Redundancy:

• a waste of memory

• high update cost

• data inconsistency

• Data Incompleteness

• Data Insecure

• Application Program Unstable

• file system (application program)

data changed data structure changed

program changed

Page 8: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-8

Objectives of Database Systems:• eliminate unnecessary data redundancy

• maintain data integrity

• control security

• achieve data independence

• add program stability

0.1 Why Database Systems? Solution: Database Systems!!

Page 9: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-9

Language Processor

Optimizer

Operation Processor

Access Method

File Manager

Database

QueryDBMS

SQL: Select S#, P# from S, P

where…..

0.2 Architecture for a Database System View 1: DBMS Components

Page 10: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-10

Host Language

+ DSL

Host Language

+ DSL

Host Language

+ DSL

Host Language

+ DSL

Host Language

+ DSL

User A1 User A2 User B1 User B2 User B3

External View@ # &

External ViewB

External/conceptualmapping A

ConceptualView

External/conceptualmapping B

Conceptual/internalmapping

Stored database (Internal View)

Databasemanagementsystem Dictionary

(DBMS) e.g. system

catalog

<

DBA

Storagestructuredefinition(Internalschema)

Conceptualschema

Externalschema

A

Externalschema

B

(Build andmaintainschemas

andmappings)

# @&

DSL (Data Sub. Language)

C, C++

e.g. SQL1 2 3

1 2 3 ... 100

0.2 Architecture for a Database System View 2: Three Tiers

Page 11: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-11

Scan figure

0.2 Architecture for a Database System: View 3: User’s View vs. Internal

Page 12: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-12

Scan figure

0.2 Architecture for a Database System: View 4: DBA vs. Programmers

Page 13: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-13

Hierarchical Data Model

Network Data Model

Relational Data Model

Object-Oriented Data Model

0.3 Data Models:

Page 14: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-14

Hierarchical Data Model

Course# Title

Course

Prereq.# Off.# Date Location

Emp.# Name GradeEmp.# Name

Offering

Teacher

course# name prereq off. 1 off. 2

prereq.1 prereq.2

92/9/6

course# name prereq.1 prereq.2 off.1 92/9/6 EE108 T003 Yang “Data Pile”

Student

PreReq

Page 15: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-15

Network Data Model

S P

S-SP P-SP

QTY

(Links)

S# SNAME STATUS CITY

SP

Page 16: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-16

S1 P1 300……S2 P1 300S2 P2 400-- -- ---

SP

P

S S1 Smith 20 London S2 S3 S4 S5

P1 P2 P3 P4 P5 P6

300

200

400

200

100

100

300

400

200

200

300

400

The Network Model: Sample Values

Page 17: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-17

System R

DB2

INGRES

Oracle

Informix

ACCESS

SP :Shipment

S# P# QTY

S1 P1 300

S1 P2 200

S1 P3 400

. . .

S2 P1 400

S2 P2 200

S1 Smith 20 London

S2 Jones 10 Paris

S3 : : :

S4 : : :

S: Supplier

S# NAME Status City

P: Parts

P# P-Name Color Weight …………

P1 Nut Red 12 ……

P2 Screw Blue 17 .

P3 : : : :

: : : : :

Relational Data Model: [Codd70]

Page 18: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-18

Person

Object-Oriented Data Model

Employee

face-image

Vehicle

Company

dept. salary

name

name location

model

hair-colorname

ownsphoto

manu.

car-video

video

aggregation

inheritance

Page 19: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-19

DDL (Data Definition Language) DML (Data Manipulation Language) Data Dictionary Utility Routines

0.4 Components of a Database System

Page 20: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-20

CREATE TABLE S (S# CHAR(5) NOT NULL, SNAME CHAR(20) NOT NULL, STATUS SMALLINT NOT NULL, CITY CHAR(15) NOT NULL, PRIMARY KEY (S#));

ALTER TABLE S ADD DISCOUNT SMALLINT;

DROP TABLE S

CREATE INDEX XSC ON S (CITY);CREATE UNIQUE INDEX X ON S (S#);

DROP INDEX XSC;

0.4 Components of a Database System:

DDL (Data Definition Language)

S: Supplier

S# NAME Status City

Page 21: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-21

SELECT S#, STATUSFROM SWHERE CITY=‘PARIS’

UPDATE SSET STATUS= 2*STATUSWHERE CITY=‘LONDON’;

DELETE FROM SWHERE S#= ‘S5’

INSERT INTO S (S#, SNAME, STATUS, CITY)VALUES(‘S6’,’TSENG’,100,’HSINCHU’)

0.4 Components of a Database System:

DML (Data Manipulation Language)

S: Supplier

S# NAME Status City

Page 22: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-22

0.4 Components of a Database System:

Data Dictionary

Application Program

9

Working Area

System Buffer

Secondary Memory

Database

DBMS DataDictionary

OS

Request

return1

8

2

3

4

5

7

6

Page 23: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-23

• Loading Routines

• Reorganization Routines

• Journalizing routines (log)

• Database Dump Routines

• Recovery Routines

• Statistical Analysis Routines

• …

0.4 Components of a Database System:

Utility Routines:

Page 24: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-24

STEP 1: Database Design• Logical database vs. physical database• Collect data of applications• Analyze data to eliminate redundancy (using normalization

theory and E-R Model…)• Describe data in the specific Data Model the DBMS use.• Describe each schema in DDL

STEP 2: Implementation• schema • data

SETP3:Evaluation and Correction (by DBA)• tuning• statistical analysis

0.5 How to Establish a Database System?

Page 25: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-25

Advantages of database systems• redundancy can be reduced

• Inconsistency can be avoid

• Data can be shared

• Standards can be enforced

• Security restrictions can be applied

• Integrity can be maintained

• Provision of data independence

Disadvantages of database systems• Database design and control is a complicated matter.

0.6 Discussion and Remarks

Page 26: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-26

• Expert Database Systems Knowledge-base Management Systems AI + DB

• Image Database Systems Intelligent Pictorial Databases Image + DB

• Object-Oriented Database Systems OO Programming + DB

• Multimedia Database Text + Voice + Image + …..+ DB

• Multidatabases Integrate heterogeneous /homogeneous database systems

0.7 Extending Database Technology

Page 27: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-27

• Real-time Database Systems Real-time Tech. + DB

• Video Database Systems MPEG + DB

• Digital Library Library + DB

• Bioinformatic Database Systems Biological + DB

• …

Extending Database Technology

Page 28: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-28

  

0.8 DS and Database 課程流程圖

二下 : 資料庫管理

研上 : 高等資料庫管理

三四上 : 資料庫進階

一上 : 計算機概論

研上 : 高等資料庫管理

研下 : 影像資料庫

二上 : 資料結構

大一

大三四

大二

研究所

基本 , 入門 , 觀念

原理 , 研究

研下 : 多媒體資料庫 研下 : 知識庫管理

一下 : 程式設計II

一上 : 程式設計I

Sorting, Hashing, 檔案結構 , web, 實例應用

< 大學可先修研究所課程 >

Page 29: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-29

Chapter 1: Introduction

Chapter 2: Entity-Relationship Model

Chapter 3: Relational Model

Chapter 4: SQL

Chapter 5: Other Relational Languages

Chapter 6: Integrity Constraints

Chapter 7: Relational Database Design

資料庫管理 ( 大二下 )

References: 1. Silberschatz etc, Database System Concepts, 5th edition, McGraw Hill, 2006

Page 30: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-30

Unit 1: Sorting (DS. Chapter 7)

Unit 2: Hashing (DS. Chapter 8)

Unit 3: Heap Structure (DS. Chapter 9)

Unit 4: Searching Structure (DS. Chapter 10)

Unit 5: XML (DBMS Chapter 10)

Unit 6: Storage and File Structure (DBMS Chapter 11)

Unit 7: Indexing and Hashing (DBMS Chapter 12)

資料庫進階 ( 大三四上 )

References: 1. A. Silberschatz, etc, Database System Concepts, 5th edition, McGraw Hill, 2006

2. E. Horowitz, etc. Fundamentals of Data Structures, …

Page 31: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-31

PART 0 Basic Concepts

Chapter 0: Overview

Chapter 1: Introduction

PART 1 RELATIONAL DATABASES

Chapter 2: Relational Model

Chapter 3: SQL

Chapter 4: Advanced SQL

PART 2 DATABASE DESIGN

Chapter 6: Database Design and the E-R Model

Chapter 7: Relational Database Design

Chapter 8: Application Design and Development

PART 4 DATA STORAGE AND QUERYING

Chapter 11: Storage and File Structure

Chapter 12: Indexing and Hashing

資料庫管理 ( 大二下 ) 今 年

Text Book: A. Silberschatz etc, “Database System Concepts,” 5th edition, McGraw Hill, 2006

Page 32: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-32

Unit 1 Introduction to DBMSUnit 2 DB2 and SQLUnit 3 The Relational ModelUnit 4 The Hierarchical Model Unit 5 The Network ModelUnit 6 Access MethodsUnit 7 Logical Database DesignUnit 8 Database RecoveryUnit 9 Concurrency ControlUnit 10 Security and IntegrityUnit 11 Query OptimizationUnit 12 Distributed Database

高等資料庫管理 ( 研究所下 )

References: 1. C. J. Date, An Introduction to Database Systems, 8th edition, 2004. 2. J. D. Ullman, Principles of Database and Knowledge-Base, Vol.I, 1988. 3. Cited papers

Page 33: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-33

Unit 13 Object-oriented Database

Unit 14 Logic-Based Database

Unit 15 Image Database

Unit 16 Multimedia Database

Unit 17 Multidatabase

Unit 18 Real-time Database

Unit 19 Parallel Database

Unit 20 Temporal Database

Unit 21 Active Database

Unit 22 Bioinformatic Database

Unit 23 ….

高等資料庫管理 II ( 研究所 )

References: Cited papers from Journals and conferences

Page 34: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-34

GenBank Database Growth

Page 35: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-35

Protein Database Growth

Page 36: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-36

Entrez Developed at NCBI, freely available and allow for integrated

access to PubMed records, nucleotide and protein sequence data and 3D structure information

http://www.ncbi.nlm.nih.gov/Entrez

Page 37: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-37

Page 38: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-38

Page 39: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-39

Level 5: Doing Research

Level 4: Survey Papers: Special Topics (Unit 13 - )

Level 3: DBMS: Advanced Topics(Unit 7 – 12)Date, Vol. 1, 2

Ullman

Level 2: DBMS: Fundamentals(Unit 1 – 6)

Date, Vol. 1Using DB2,

Project: Design a “mini” DBMS

Level 1: Using DBMS

0.9 Research on Database

Page 40: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-40

Journals:• ACM Trans. On Database Systems (TODS)• IEEE Trans. On Software Engineering (TOSE)• IEEE Trans. On Knowledge and Data Engineering• ACM Trans. On Office Information Systems (TOOIS)• Journal of Information Science and Engineering • …

Conferences:• VLDB (Very Large Data Base)• ACM SIGMOD • PODS (Principal of Database Systems)• IEEE Data Engineering• NCS, ICS (National/International Computer Symposium)• …

Where to find Database papers?

Taiwan

Taiwan

Page 41: Wei-Pang Yang, Information Management, NDHU 0-1 DATABASE SYSTEMS OVERVIEW 國立東華大學 資訊管理系 楊維邦 教授

Wei-Pang Yang, Information Management, NDHU 0-41

Why Database Systems?

An Architecture for a Database System

Data Models

Components of a Database System

How to establish a Database System?

Discussion and Remarks

Extending Database Technology

Data Structure and Database 課程流程圖 Research on Database

DATABASE SYSTEMSDATABASE SYSTEMS:: OVERVIEW OVERVIEW