Академический Документы
Профессиональный Документы
Культура Документы
Introduction to DBMS
(Database Management Systems)
Application
program End-user
DBMS
• PART I:
• Overview
• DB2 SQL
• (The Relational Model)
• (The Hierarchical Model)
• (The Network Model)
• PART III:
• (Access Methods)
• (Database Recovery)
• (Concurrency Control)
• (Security and Integrity)
• (Query Optimization)
• (Distributed Database)
1-6
Stages of Information System
Stage 0: Manual Information System
• Records
• Files
• Index Cards
Stage 1: Sequential Information Systems
• Tapes
• Files
• slow, non-interactive, redundancy,... .
Stage 2: File Based Information Systems
• Disk (direct access)
• application program has its own file data dependence
• data redundancy
Stage 3: DBMS based Information Systems
• Generalized data management software
• Transaction processing
醫院診所病歷卡
Application Application
Program A
File System A Customer
System A
Application
Application File System B Invoice
Program B
System B
Application Application
System N Program N File System N Inventory
Customer Invoice
Customer No. Customer No.
Customer Name Customer Name
Part No.
Customer Addr.
Quantities
Social Security ID Unit Price
Inventory
Parts
Part No.
Part Description Part No.
Unit Price Part Description
Supplier Supplier
Quantities Remain Quantities Ordered
Quantities Ordered Customer Name
Unit Price
Application
program
End-user
Wei-Pang Yang, Information Management, NDHU Unit 1 Introduction to DBMS 1-14
Stage 3: 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';
Language Processor
DBMS Access Methods Calls
Access Method
(B+ tree, Dynamic Hashing)
I/O calls
( (S SP)
Optimizer Language
Operator :
SCAN C using region index, create C Processor
SCAN I using amount index, create I
SORT C?and I?on C#
JOIN C?and I?on C#
EXTRACT name field
Operator Processor
database
1-19
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
Computer Scientists:
Developed a lot of concepts and techniques for MOD
Concepts and techniques form the focus of this course
DBMS
Application
program
End-user
Wei-Pang Yang, Information Management, NDHU Unit 1 Introduction to DBMS 1-22
Database System: Major components
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
Wei-Pang Yang, Information Management, NDHU Unit 1 Introduction to DBMS 1-23
An Example: Supplier-and-Parts Database
<e.g.> Supplier-and-Parts Database
S S# SNAME STATUS CITY P P# PNAME COLOR WEIGHT CITY SP S# P# QTY
S1 Smith 20 London P1 Nut Red 12 London S1 P1 300
S2 Jones 10 Paris P2 Bolt Green 17 Paris S1 P2 200
S3 Blake 30 Paris P3 Screw Blue 17 Rome S1 P3 400
S4 Clark 20 London P4 Screw Red 14 London S1 P4 200
S5 Adams 30 Athens P5 Cam Blue 12 Paris S1 P5 100
P6 Cog Red 19 London S1 P6 100
S2 P1 300
S2 P2 400
Query: S3 P2 200
• 列出住在London 的供應商名字?
S4 P2 200
S4 P4 300
• Get the total number of suppliers. S4 P5 400
1-25
Why Database System?
Answer: Easy to retrieve information! Query:
Word, Excel vs. Access • 列出住在London 的供
<e.g.> Supplier-and-Parts Database 應商名字?
S S# SNAME STATUS CITY SP S# P# QTY
• Get the total number of
S1 Smith 20 London S1 P1 300 suppliers.
S1 P2 200
S2
S3
Jones
Blake
10
30
Paris
Paris S1 P3 400 • Total QTY of SP?
S4
S5
Clark
Adams
20
30
London
Athens
S1
S1
P4 200
P5 100 • Get supplier names for
S1 P6 100 suppliers who supply
S2 P1 300
P P# PNAME COLOR WEIGHT CITY S2 P2 400
part P2?
P1
P2
Nut
Bolt
Red
Green
12
17
London
Paris
S3
S4
P2 200
P2 200
• Get supplier names for
P3 Screw Blue 17 Rome S4 P4 300 suppliers who supply
P4 Screw Red 14 London S4 P5 400
P5 Cam Blue 12 Paris red color parts?
P6 Cog Red 19 London
• …
Inventory
Parts
Part No.
Part Description Part No.
Unit Price Part Description
Supplier Supplier
Quantities Remain Quantities Ordered
Quantities Ordered Customer Name
Unit Price
DB
S s1 s2 sn
Top if item = TOP . item then .........
• Tree:
.
• Array:
if A[I] = item then ............
1-38
Architecture for a Database System: view 1
Query
DBMS
Language Processor
Optimizer
Operation Processor
Access Method
File Manager
Database
External/conceptual External/conceptual
mapping A mapping B
Database
Conceptual Conceptual management
< schema View system Dictionary
(DBMS) e.g. system
catalog
DBA Conceptual/internal
(Build and mapping
maintain
schemas
and Storage
1 2 3 ... 100
mappings) structure
definition Stored database (Internal View) # & @
(Internal
schema)
Scan figure
Scan figure
1-46
Data Models:
Course 92/9/6
PreReq Offering
Prereq.# Off.# Date Location
Teacher Student
Emp.# Name Emp.# Name Grade
S P
S# SNAME STATUS CITY
SP QTY
System R
DB2
<e.g.> Supplier-and-Parts Database
INGRES S S# SNAME STATUS CITY SP S# P# QTY
S1 Smith 20 London S1 P1 300
Oracle S2 Jones 10 Paris S1 P2 200
S3 Blake 30 Paris S1 P3 400
Informix S1 P4 200
S4 Clark 20 London
ACCESS S5 Adams 30 Athens S1 P5 100
S1 P6 100
mySQL S2 P1 300
P P# PNAME COLOR WEIGHT CITY S2 P2 400
… P1 Nut Red 12 London S3 P2 200
P2 Bolt Green 17 Paris S4 P2 200
P3 Screw Blue 17 Rome S4 P4 300
P4 Screw Red 14 London S4 P5 400
P5 Cam Blue 12 Paris
P6 Cog Red 19 London
aggregation
Query Graphics
User None languages Natural language
Forms Menus
Interface - SQL, QUEL Speech input
Query-by-forms
1-54
PART II: (Database Design)
:
DBMS
- (Entity-Relationship Model, E-R Model)
E-R Model
- ,
, -
(E-R Diagram)
:
- (Tables) (tables)
(Normalization)
:
Physical Design
database?
Computer Science decision – What relation schemas should we
Phase II
Conceptual design (unit 6)
Design tables
Normalization (unit 7)
Phase III
Specification of functional requirements
Phase IV
User interface design (unit 8)
Implementation
DROP TABLE S
1-65
Extending Database Technology
• Expert Database Systems
Knowledge-base Management Systems
AI + DB
• Multimedia Database
Text + Voice + Image + …..+ DB
• Multidatabases
Integrate heterogeneous /homogeneous
database systems
Wei-Pang Yang, Information Management, NDHU Unit 1 Introduction to DBMS 1-66
Extending Database Technology (cont.)
• Real-time Database Systems
Real-time Tech. + DB
• Digital Library
Library + DB
• …
Taipei
communication Kaoshiung
links
Taichung
Multidatabase
Relational Object-
Hierarchical
Model Oriented
Model
Model
• semantic inconsistency
• data incompleteness
• global schema
Query DBMS
Language Processor
Query Optimizer Knowledge
Base
Operator Processor
Access Method
File Manager
Distributed Logical
DB design DB design
Knowledge Knowledge
Base Base
A Combined Model :
Logic Programming + Relational DB
Three layers : User Program Query :
? :- ancestor (taro, Y)
? :- grandfather (?, c)
Knowledge
management IDB:
program ancestor(X,Y):- parent(X,Y)
IDB
ancestor(X,Y) :- parent(X,Z), ancestor(Z,Y)
parent(X,Y):-edb(father(X,Y))
relational parent(X,Y):-edb(mother(X,Y))
interface grandfather(X,Z):- father(X,Y) ^ father(Y,Z)
father mother
EDB: father son
Relational DB
A B
management X Y
program EDB . . . .
B C
Workstation . . .
Database
Server
Workstation
homework's on workstations.
} image
DBMS
Preliminary- Database Management Test /
design Inspection
System
APPLICATION
Design Design
Evaluation Synthesis Release
Analysis Verification
DB VR
DB DNA/BioInfo
1995 ? 2003 .
?
DB Mobile/video DB ???
1999
20xx ?
?
1-77
Discussion and Remarks
Advantages of database systems
• Easy to retrieve information!
• 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
Unit 20 More on X?
----------------------------------------------------
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
Wei-Pang Yang, Information Management, NDHU Unit 1 Introduction to DBMS 1-81
Contents of PART VI:
Unit 21 Object-Oriented Database
Unit 22 Logic-Based Database
Unit 23 Image Database
Unit 24 Multimedia Database
Unit 25 Real-Time Database
Unit 26 Parallel Database
Unit 27 Temporal Database
Unit 28 Active Database
Unit 29 Bioinformatics Database
Unit 30 ….
----------------------------------------------------
References:
1. Cited papers