35
1-1 Unit 1 Introduction to DBMS (Database Management Systems) Application program End-user DBMS tp://www.iis.sinica.edu.tw/~jdwei/dbs20

Unit 1 Introduction to DBMS (Database Management Systems)

  • Upload
    faolan

  • View
    55

  • Download
    2

Embed Size (px)

DESCRIPTION

Application program. End-user. DBMS. Unit 1 Introduction to DBMS (Database Management Systems). http://www.iis.sinica.edu.tw/~jdwei/dbs2010  . Outline of Unit 1. 1.1 Information Systems 1.2 An Overview of a Database System 1.3 An Architecture for a Database System - PowerPoint PPT Presentation

Citation preview

Page 1: Unit  1 Introduction to DBMS (Database Management Systems)

1-1

Unit 1Introduction to DBMS

(Database Management Systems)

Application program End-user

DBMS

http://www.iis.sinica.edu.tw/~jdwei/dbs2010  

Page 2: Unit  1 Introduction to DBMS (Database Management Systems)

1-2

Outline of Unit 1

1.1 Information Systems

1.2 An Overview of a Database System

1.3 An Architecture for a Database System

1.4 Database Technology Trends

Page 3: Unit  1 Introduction to DBMS (Database Management Systems)

1-3

1.1 Information Systems

Page 4: Unit  1 Introduction to DBMS (Database Management Systems)

1-4

Stages of Information System Stage 0: Manual Information System (1900- WWII)

• Records• Files• Index Cards

Stage 1: Sequential Information Systems (1950-1960)• Tapes• Files• slow, non-interactive, redundancy,... .

Stage 2: File Based Information Systems (1960-1980)• Disk (direct access) • application program has its own file data dependence• data redundancy

Stage 3: DBMS based Information Systems (1980-present)• Generalized data management software• Transaction processing

Page 5: Unit  1 Introduction to DBMS (Database Management Systems)

1-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

File Based Information Systems

Page 6: Unit  1 Introduction to DBMS (Database Management Systems)

1-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

File Based Information Systems (cont.)

Page 7: Unit  1 Introduction to DBMS (Database Management Systems)

1-7

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, Pascal, PHP

e.g. SQL1 2 3

1 2 3 ... 100

閃開!讓專業的來

Page 8: Unit  1 Introduction to DBMS (Database Management Systems)

1-8

DBMS based Information Systems:

Basic Approach - Integration (1) Integration of Information

• Description of the integrated view of data is the "Conceptual Schema" of the database

Application program

End-user

DBMS

好處:正確、簡易、快速、可靠 …

Page 9: Unit  1 Introduction to DBMS (Database Management Systems)

1-9

DBMS based Information Systems:

Basic Approach – Simple views and High level language (2) Provide simple views (External Schema) and high level language

(e.g. SQL) for users to manipulate (handle) data

• High level language: e.g. SQL (Structured Query Language)<e.g.>: SELECT SNAME FROM S WHERE S#= 'S4';

• Description of user's view of data is the "external schema" or "subschema" or "view".

• High-level languages (Query Language): SQL (1) Data Definition Language: define format

(2) Data Manipulation Language: retrieve, insert, delete, update

• Emphasize: EASE OF USE !!

S

S# name

Page 10: Unit  1 Introduction to DBMS (Database Management Systems)

1-10

DBMS based Information Systems: Basic Approach - Storage/Access Method

(3) Efficient Storage/Access Techniques:

• implemented once rather than duplicated in all application programs.

Language Processor

Access Method(B+ tree, Dynamic Hashing)

DBMS

User: query in SQL

Access Methods Calls

I/O calls

Page 11: Unit  1 Introduction to DBMS (Database Management Systems)

1-11

DBMS based Information Systems: Basic Approach - Transaction Management

(4) Provide Transaction Management:• Concurrency Control

• Recovery

• Security

• . :

Page 12: Unit  1 Introduction to DBMS (Database Management Systems)

1-12

Example: A Simple Query ProcessingQuery in SQL: SELECT CUSTOMER. NAME FROM CUSTOMER, INVOICE WHERE REGION = 'N.Y.' AND AMOUNT > 10000 AND CUTOMER.C#=INVOICE.C

Internal Form :

( (S SP)

Operator : SCAN C using region index, create C SCAN I using amount index, create I SORT C?and I?on C# JOIN C?and I?on C# EXTRACT name field

Calls to Access Method: OPEN SCAN on C with region index GET next tuple . . .

Calls to file system: GET10th to 25th bytes from block #6 of file #5

Language Processor

Optimizer

Operator Processor

Access Method

File System

database

LanguageProcessor

AccessMethod

e.g.B-tree; Index; Hashing

DBMS

Page 13: Unit  1 Introduction to DBMS (Database Management Systems)

1-13

1.2 An Overview of a Database System

Page 14: Unit  1 Introduction to DBMS (Database Management Systems)

1-14

An Example The Wine Cellar Database:

Cellar:

Retrieval:

• DML (Data Manipulation Language): SELECT Wine, Bin, Producer FROM Cellar WHERE Ready = 85;

• Result:

2 Chardonnay Buena Vista 83 1 85 3 Chardonnay Louis Martini 81 5 84 6 Chardonnay Chappellet 82 4 85 Thanksgiving12 Jo. Riesling Buena Vista 82 1 83 Late Ha

rvest16 Jo. Riesling Sattui 82 1 83 Very dr

y43 Cab. Sauvignon Robt. Mondavi 77 12 8750 Pinot Noir Mirassou 77 3 85 Harves

t51 Pinot Noir Ch. St. Jean 78 2 86

Bin Wine Producer Year Bottle Ready Comments

Wine Bin ProducerChardonnay 2 Buena VistaChardonnay 6 ChappelletPinot Noir 50 Mirassou

Page 15: Unit  1 Introduction to DBMS (Database Management Systems)

1-15

An Example (cont.)

Deletion:

• DML: DELETE FROM Cellar WHERE Ready < 86;

• Result:

Insertion:

• DML: INSERT INTO Cellar VALUES (53, 'Pinot Noir', 'Franciscan', 79, 1, 86, 'for Joan');

• Result:

43 Cab. Sauvignon Robt. Mondavi 77 12 8751 Pinot Noir Ch. St. Jean 78 2 86

Bin Wine Producer Year Bottle Ready Comments

43 Cab. Sauvignon Robt. Mondavi 77 12 8751 Pinot Noir Ch. St. Jean 78 2 8653 Pinot Noir Franciscan 79 1 86

for Joan

Bin Wine Producer Year Bottle Ready Comments

Page 16: Unit  1 Introduction to DBMS (Database Management Systems)

1-16

An Example (cont.)

Update

• DML: UPDATE Cellar

SET Bottles = 4

WHERE Bin = 51;

• Result:

43 Cab. Sauvignon Robt. Mondavi 77 12 8751 Pinot Noir Ch. St. Jean 78 4 8653 Pinot Noir Franciscan 79 1 86

for Joan

Bin Wine Producer Year Bottle Ready Comments

Page 17: Unit  1 Introduction to DBMS (Database Management Systems)

1-17

What is a Database System?

Application program

End-user

DBMS

Page 18: Unit  1 Introduction to DBMS (Database Management Systems)

1-18

What is a Database System? (cont.)

Major components of a database system:• Data: integrated and shared.• Hardware: disk, CPU, Main Memory, ...• Software: DBMS• Users:

1. Application programmers 2. End users 3. Database administrator (DBA)

• Defining external schema• Defining conceptual schema• Defining internal schema • Liaison with users • Defining security and integrity checks • Defining backup and recovery procedures • Monitoring performance and changing requirements

Page 19: Unit  1 Introduction to DBMS (Database Management Systems)

1-19

Why Database ? Redundancy can be reduced

Inconsistency can be avoided

The data can be shared

Standards can be enforced

Security restrictions can be applied

Integrity can be maintained Provision of data independence

objective !

Page 20: Unit  1 Introduction to DBMS (Database Management Systems)

1-20

Data Independence

Application Program Data Structure

Immunity of application to change in storage structure and access strategy.

Page 21: Unit  1 Introduction to DBMS (Database Management Systems)

1-21

Data Dependence vs. Data Independence Data Dependent

e.g. SELECT CITY FROM S WHERE ITEM = 'X';

• Linked list: TOP

if item = TOP. item then .........

• Tree:

. if item < root.data then root := root.left ..........

• Array:

if A[I] = item then ............

• Storage structure changed program changed

S

S#S1

S2

:Sn

STop

s1 s2 sn

Page 22: Unit  1 Introduction to DBMS (Database Management Systems)

1-22

1.3 An Architecture for aDatabase System

Page 23: Unit  1 Introduction to DBMS (Database Management Systems)

1-23

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@ # A &

External ViewB

External/conceptualmapping A

ConceptualView

External/conceptualmapping B

Conceptual/internalmapping

Stored database (Internal View)

Databasemanagement

system(DBMS)

<

DBA

Storagestructuredefinition(Internalschema)

Conceptualschema

Externalschema

A

Externalschema

B

(Build andmaintainschemas

andmappings)

# @&

(Data Sub Language)

#A@ &

e.g. SQL, QUEL

Page 24: Unit  1 Introduction to DBMS (Database Management Systems)

1-24

An Example of the Three Levels Internal level:

STORED_EMP length = 18 PREFIX TYPE = BYTE(6), OFFSET = 0, INDEX = EMPX EMP# TYPE = BYTE(6), OFFSET=6, DEPT# TYPE = BYTE(4), OFFSET = 12 PAY TYPE = FULLWORD, OFFSET = 16

Conceptual level:EMPLOYEE EMPLOYEE_NUMBER CHARACTER(6) DEPARTMENT_NUMBER CHARACTER(4) SALARY NUMERIC(5)

External level:• ( PL /I ) DCL 1 EMP 2 EMP# CHAR(6) 2 SAL FIXED BIN(31)

• (COBOL) 01 EMPC 02 EMPNO PIC X(4) 02 DEPTNO PIC X(4)

Page 25: Unit  1 Introduction to DBMS (Database Management Systems)

1-25

Functions of the DBMS

Data Definition Language (DDL)

Data Manipulation Language (DML)

Data Security and Integrity

Data Recovery and Concurrency

Data Dictionary

Performance

Page 26: Unit  1 Introduction to DBMS (Database Management Systems)

1-26

1960s to

Mid-1970s1970s to

Mid-1980sLate

1980sFuture

Data Model

Database Hardware

UserInterface

ProgramInterface

Presentationand displayprocessing

NetworkHierarchical

Mainframes

NoneForms

Procedural

ReportsProcessingdata

Relational

MainframesMinisPCs

Query languages- SQL, QUEL

Embeddedquerylanguage

ReportgeneratorsInformationand transactionprocessing

SemanticObject-orientedLogic

Faster PCsWorkstationsDatabase machines

GraphicsMenusQuery-by-forms

4GLLogic programming

Business graphicsImage outputKnowledgeprocessing

Merging data models, knowledge representation,and programminglanguages

Parallel processingOptical memories

Natural languageSpeech input

Integrated databaseand programminglanguage

Generalized displaymanagersDistributed knowledgeprocessing

1.4 Database Technology Trends

Page 27: Unit  1 Introduction to DBMS (Database Management Systems)

1-27

Distributed Databases

Database Distributed System

Distributed database is a database that is not stored in its entirety at a single physical location, but rather is spread across a network of computer.

Hsinchu

Taipei

Kaoshiung

computers

Taichung

communication links

< e.g.>

Page 28: Unit  1 Introduction to DBMS (Database Management Systems)

1-28

Distributed Databases (cont.)

Advantages: efficiency of local processing data sharing

Disadvantages: communication overhead implementation difficulties

Reference: S. Ceri and G. Pelagatti "Distributed Databases: principles and systems"

Page 29: Unit  1 Introduction to DBMS (Database Management Systems)

1-29

Multi-Database/Heterogeneous Database

Multidatabase

IMS INGRES ORION. . .Hierarchical Model

Relational Model

Object-OrientedModel

• semantic inconsistency

• data incompleteness• global schema

Page 30: Unit  1 Introduction to DBMS (Database Management Systems)

1-30

DB + AI Database AI

Language Processor

Query Optimizer

Operator Processor

Access Method

File Manager

Query

DistributedDB design

LogicalDB design

KnowledgeBase

KnowledgeBase

KnowledgeBase

DBMS

Page 31: Unit  1 Introduction to DBMS (Database Management Systems)

1-31

KBMS

A Combined Model : Logic Programming + Relational DB

Three layers :

Database Logic

User Program

Knowledgemanagement

program

Relational DBmanagement

program

IDB

EDB

relationalinterface

Query : ? :- ancestor (taro, Y) ? :- grandfather (?, c)

IDB: ancestor(X,Y):- parent(X,Y) ancestor(X,Y) :- parent(X,Z), ancestor(Z,Y) parent(X,Y):-edb(father(X,Y)) parent(X,Y):-edb(mother(X,Y)) grandfather(X,Z):- father(X,Y) ^ father(Y,Z)

EDB: father son A B X Y . . . . B C

father

mother

Page 32: Unit  1 Introduction to DBMS (Database Management Systems)

1-32

OODB A typical Document : MEMO [Woelk86, SIGMOD]

Database Object-Oriented

MCCTo: W. KimFrom: D. WoolkDate: September 18, 1992 can be heard

Subject: Workstations

In the computer center of National Chiao-Tung University, there are a lot of workstations. There are HP RS serials, SUNs, Apollo, and so on. The students in NCTU learn to use workstation since they are fresh-men. The configuration of the workstations follows:

. . .

In the course introduction to Computer Science? students do their homework's on workstations.

Workstation Workstation

DatabaseServer

speakervoice message

associated

} text

}graphics

}image

Page 33: Unit  1 Introduction to DBMS (Database Management Systems)

1-33

Use of a Database Management System in Design and Application

DesignAnalysis

DesignVerification

Evaluation Synthesis Release

ManufacturingPlanning

ProductionControl

ProjectManagement

APPLICATION

DBMSDatabase Management

System

Graphic Interface Language InterfaceINTERFACE

Preliminary- design

Analysis Models

Detailed Design

DesignReleaseControl

Fabrication Assembly Info

Test / Inspection

Database Manufacturing

Page 34: Unit  1 Introduction to DBMS (Database Management Systems)

1-34

Fuzzy Database

Fuzzy Query

Database Fuzzy Set Theory

<e.g.> SELECT STUDENT.NAME FROM STUDENT WHERE SEX = M AND HEIGH = TALLER AND WEIGH = SLIMMERSTUDENT:

NAME SEX HEIGHT WEIGHT IQ

Mary F 158 55 HighLinda F 165 55 Medium

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

<e.g.> SELECT STUDENT.NAME FROM STUDENT WHERE IQ >= 130

Page 35: Unit  1 Introduction to DBMS (Database Management Systems)

1-35

More?

DB AI

DB VR

?

?

DB

?

WWW

1993

1995

1997

DB

?

Mobile/video 1999

?2003

DB

911/ Anthrax

? 2001

DB

DNA/BioInfo.

?2004

DB ??? SARS

?2006

DB ???