introduction to database management · pdf filedbms database application ... application...

40
การจัดการฐานข้อมูล Introduction to Database Management Asst.Prof. Intiraporn Mulasastra

Upload: docong

Post on 18-Feb-2018

235 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

การจดการฐานขอมล

Introduction to Database Management

Asst.Prof. Intiraporn Mulasastra

Page 2: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

2

Outline

Database characteristics

DBMS features

Architectures

Organizational roles

Asst.Prof. Intiraporn Mulasastra

Page 3: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

3

Initial Vocabulary

Data: raw facts about things and events

Information: transformed data that has value for decision making

Essential to organize data for retrieval and maintenance

Asst.Prof. Intiraporn Mulasastra

Page 4: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

4

Database Characteristics

Persistent - Lasts a long time - Relevance of intended usage: only store

potentially relevant data Inter-related: - Entity: cluster of data about a topic (customer,

student, loan) - Relationship: connection among entities Shared: - Multiple uses: hundreds to thousands of data

entry screens and reports - Multiple users: many people simultaneously use

a database

Asst.Prof. Intiraporn Mulasastra

Page 5: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

5

University Database

University Database

Registration

Grade

Recording

Faculty

Assignment

Course

Scheduling

Entities:

students, faculty, courses,

offerings, enrollments

Relationships:

faculty teach offerings,

students enroll in

offerings, offerings made

of courses, ...

Asst.Prof. Intiraporn Mulasastra

Page 6: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

Electric Utility Database

Billing

Meter

Reading

Payment

Processing

Service Start/

Stop

Entities:

customers, meters, bil ls,

payments, meter readings

Relationships:

bi l ls sent to customers,

customers make payments,

customers use meters, ...

6 Asst.Prof. Intiraporn Mulasastra

Page 7: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

7

Database Definition

Define database before using

Tables and relationships

SQL CREATE TABLE statement

Graphical tools

Asst.Prof. Intiraporn Mulasastra

Page 8: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

8

A database : A self describing

collection of integrated records

1. A database is self describing

2. A database is a collection of integrated

records

Asst.Prof. Intiraporn Mulasastra

Page 9: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

9

File

Bits bytes fields records files

Student Record •ID •FirstName •LastName

ID FirstNaทe LastName 101 ชาตไทย ใจด 102 สมศร สขสมร 103 มาด มสข 104 มานะ อดทน

Asst.Prof. Intiraporn Mulasastra

Page 10: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

10

A database is a collection of integrated

records

Bits bytes fields records files + Metadata +

Indices +

Application

Metadata

Database

Bits bytes fields records files

Asst.Prof. Intiraporn Mulasastra

Page 11: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

11

Entity Relationship Diagram

(University Database)

StdSSN

StdClass

StdMajor

StdGPA

Student

OfferNo

OffLocation

OffTime

Offering

EnrGrade

Enrollment

Registers

Accepts

CourseNo

CrsDesc

CrsUnits

Course

FacSSN

FacSalary

FacRank

FacHireDate

Faculty

Has

Teaches

Supervises

Asst.Prof. Intiraporn Mulasastra

Page 12: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

12

University Database

Asst.Prof. Intiraporn Mulasastra

Page 13: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

13

contain Data Dictionary (Metadata)

จดเกบโครงสรางของทกๆไฟล ในฐานขอมล

updated อตโนมตเมอแกไขโครงสรางไฟล

A database is self describing

โปรแกรมและฐานขอมลเปนอสระตอกน

Asst.Prof. Intiraporn Mulasastra

Page 14: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

14

The Database

Electric User Data

ID FirstName LastName Address Province MeterNo

101 ชาตไทย ใจด 1/111 01 3815

102 สมศร สขสมร 355 01 3802

103 มาด มสข 2 ถ.ตก 22 4125

104 มานะ อดทน 155 22 4389

Asst.Prof. Intiraporn Mulasastra

Page 15: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

15

• Metadata

Systables Table

Table Name Number of Columns Primary Keys

ElectricUser 6 ID

Province 3 Code

Syscolumns Table

Column Name Table Name DataType Length

ID ElectricUser Number 3

FirstName ElectricUser Text 25

…….

SysIndexes SysKeys SysProcedure SysUsers SysReference …. Asst.Prof. Intiraporn Mulasastra

Page 16: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

16

• Indexes

Province Address

01 2,4

22 1,3

Province Index

ID FirstNmae LastName Address Province MeterNo

101 ชาตไทย ใจด 1/111 22 3815

102 สมศร สขสมร 355 01 3802

103 มาด มสข 2 ถ.ตก 22 4125

104 มานะ อดทน 155 01 4389

1

2

3

4

Record Address

ElectricUser Table

ID Address

101 1

102 2

103 3

104 4

ID Index

Asst.Prof. Intiraporn Mulasastra

Page 17: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

17

• Application Metadata

stored procedure

query

form

report

Asst.Prof. Intiraporn Mulasastra

Page 18: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

18

Data Independence

a database should have an identity separate from the applications

Software maintenance is a large part (50%) of information system budgets

Reduce impact of changes by separating database description from applications

Change database definition with minimal effect on applications that use the database

Asst.Prof. Intiraporn Mulasastra

Page 19: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

19

Three Schema Architecture

View 1 View 2 View n

Conceptual

Schema

Internal

Schema

External

Level

Conceptual

Level

Internal

Level

External to

Conceptual

Mappings

Conceptual

to Internal

Mappings

Asst.Prof. Intiraporn Mulasastra

Page 20: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

20

Differences among Levels

External FacultyAssignmentFormView: data required for

the form in (Figure 1.9)

FacultyWorkLoadReportView: data required for the report in (Figure 1.10)

Conceptual: tables in Slide 27 Internal

Files needed to store the tables

Extra files to improve performance

Asst.Prof. Intiraporn Mulasastra

Page 21: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

21

Nonprocedural Access

Query: request for data to answer a question

Indicate what parts of database to retrieve not the procedural details

Improve productivity and improve accessibility

SQL SELECT statement and graphical tools

Loop

Asst.Prof. Intiraporn Mulasastra

Page 22: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

22

Graphical Tool

for Nonprocedural Access

EnrGrade > 3.5

Asst.Prof. Intiraporn Mulasastra

Page 23: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

23

Application Development

Form: formatted document for data entry and display

Report: formatted document for display

Use nonprocedural access to specify data requirements of forms and reports

Asst.Prof. Intiraporn Mulasastra

Page 24: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

24

Sample Data Entry Form

Asst.Prof. Intiraporn Mulasastra

Page 25: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

25

Sample Report

Asst.Prof. Intiraporn Mulasastra

Page 26: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

26

Procedural Language Interface

Combine procedural language with nonprocedural access

Why

Batch processing

Customization and automation

Performance improvement

Asst.Prof. Intiraporn Mulasastra

Page 27: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

27

Transaction Processing

Transaction: unit of work that should be reliably processed

Control simultaneous users

Recover from failures

Asst.Prof. Intiraporn Mulasastra

Page 28: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

28

Database Technology Evolution

Era Generation Orientation Major Features

1960s 1st Generation File File structures and

proprietary program

interfaces

1970s 2nd Generation Network

Navigation

Networks and hierarchies

of related records,

standard program

interfaces

1980s 3rd Generation Relational Non-procedural

languages, optimization,

transaction processing

1990s 4th Generation Object Multi-media, active,

distributed processing,

more powerful operators

Asst.Prof. Intiraporn Mulasastra

Page 29: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

29

database DBMS

Application ฝาก/ถอนเงน

Application เงนก

ระบบฐานขอมล

Asst.Prof. Intiraporn Mulasastra

Page 30: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

30

การตดตอกบฐานขอมล

Database

Applications DBMS Database

Query Tools

ผใชทวไป โปรแกรมประยกต โปรแกรมระบบ

ผใชทมความร database

เครองมอจดการ DB

Asst.Prof. Intiraporn Mulasastra

Page 31: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

31

ขอดของระบบฐานขอมล

ม Database Management System ชวยจดการขอมล ขอมลอยรวมกนในฐานขอมล ลดการจดเกบขอมลซ าซอน โปรแกรม และ ฐานขอมล เปนอสระตอกน น าเสนอขอมลไดงายขน เกดการใชขอมลรวมกนมากขน ความปลอดภยของขอมล

Asst.Prof. Intiraporn Mulasastra

Page 32: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

32

Database Management System (DBMS)

Collection of components that support

•data acquisition,

•dissemination,

•storage,

•maintenance,

•retrieval,

•formatting

Asst.Prof. Intiraporn Mulasastra

Page 33: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

33

DBMS

User Query &

Reporting

Facilities

Application

Program

Development

Facilities

Securities &

Integrity

Subsystem

Database

Access

Subsystem

Data

Dictionary

Subsystem

Data

Dictionary

Database

Users

Programmers Asst.Prof. Intiraporn Mulasastra

Page 34: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

34

Database Management System (DBMS)

• จดการกบขอมลปรมาณมากๆไดด • ผใชหลายคนใชฐานขอมลไดพรอมกน • ก าหนดรปแบบโครงสรางขอมล • ก าหนดวธการจดการกบขอมล

- มภาษาคอมพวเตอรใชเขยนโปรแกรม

• มระบบจดการความปลอดภยของขอมล • ควบคมความสมบรณ และความถกตองของขอมล

(Data Model)

Asst.Prof. Intiraporn Mulasastra

Page 35: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

35

Database Management System

(DBMS)

Enterprise DBMSs

Desktop DBMSs

Embedded DBMSs

Major part of information technology infrastructure

Asst.Prof. Intiraporn Mulasastra

Page 36: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

36

DBMS Marketplace

Enterprise DBMS

Oracle: dominates in Unix; strong in Windows

SQL Server: strong in Windows

Informix: significant Unix marketshare

DB2: strong in mainframe environment

Desktop DBMS

Access: dominates

FoxPro, Paradox, Approach, FileMaker Pro

Asst.Prof. Intiraporn Mulasastra

Page 37: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

37

Client-Server Architecture

Database

Database

a) Client, server, and

database on the

same computer

b) Mulitple clients and 1 server

on different computers

c) Multiple servers and databases on different computers

Client

Server

Client Server

Client Server Server

DatabaseDatabase

Client

Client

Client

Client

Client

Asst.Prof. Intiraporn Mulasastra

Page 38: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

38

Organizational Roles

Indirect Parametric Power

Functional User

Technical Non Technical

DBA Analyst/Programmer Management

Information Systems

Specialization

Asst.Prof. Intiraporn Mulasastra

Page 39: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

39

Database Specialists

Database administrator (DBA)

More technical

DBMS specific skills

Data administrator

Less technical

Planning role

Asst.Prof. Intiraporn Mulasastra

Page 40: Introduction to Database Management · PDF fileDBMS database Application ... Application Development and Administration By Mannino . Title: Chapter 1 of Database Design, Application

40

Summary

Databases and database technology vital to modern organizations

Database technology supports daily operations and decision making

Nonprocedural access is a crucial feature

Many opportunities to work with databases

Asst.Prof. Intiraporn Mulasastra

Textbook: Database Design, Application Development and Administration By Mannino