Top Banner
Database System Concepts Computer science and technology department Liping Zhang E-mail: [email protected]
36

Database System Concepts

Feb 07, 2016

Download

Documents

anevay

Database System Concepts. Computer science and technology department. Liping Zhang E-mail: [email protected]. Textbook:. Book name: Database System Concepts ,Fourth Edition Author: Abraham Silberschatz,Henry E Korth,S.Sudarshan Press: China Machine Press. References book:. - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Database System Concepts

Database System Concepts

Computer science and technology department

Liping Zhang

E-mail: [email protected]

Page 2: Database System Concepts

Textbook :

Book name: Database System Concepts,Fourth Edition

Author: Abraham Silberschatz,Henry E Korth,S.Sudarshan

Press: China Machine Press

 

Page 3: Database System Concepts

References book :

Book name: An Introduction to Database Systems

Author: C. J.Date

Press: China Machine Press Book name: A First Course in Database Systems

Author: Jeffrey D.ullman Jennifer Widom

Press: China Machine Press

Page 4: Database System Concepts

References book :

Book name : 数据库系统概念(第三版) Author : 萨师煊 王珊 Press: Higher Education Press

Book name : 数据库系统教程 Author : 王能斌 Press: Electronics industry

Book name : 数据库系统基础 Author : 冯玉才 Press: 华中科技大学

Page 5: Database System Concepts

Database system concepts

Teaching outline: 1. in the classroom Chapter 1 Introduction Chapter 2 Entity-Relationship Model Chapter 3 Relational Model Chapter 4 SQL Chapter 5 Integrity and Security Chapter 6 Relational-Database Design Chapter 7 Query Optimization Chapter 8 Transactions Chapter 9 Concurrency Control Chapter 10 Recovery System

2.practice in the laboratory Requirement:

1.preparation

2.review

3.learn by yourself

Delphi7.0

SQLServer2000 Scores:

70%+30%

absence -3

Page 6: Database System Concepts

Chapter 1 introduction

1.1 What is a database system? 1.2 What is a database? 1.3 Purpose of database systems. 1.4 Database languages 1.5 The three levels of the

architecture

1.5.1 The three levels

1.5.2 Mappings

1.5.3 Instances and schemas

1.6 Transaction management 1.7 The Database Management

System 1.8 Application Architectures 1.9 Distributed processing

Page 7: Database System Concepts

Banking:accounts, loans,baking transactions. Airlines: reservations ,schedule information. Universities:, student information,course registration, grades. Credit card transactions: purchases on credit cards, generation

of monthly statements. Telecommunication: keeping records of calls made. Finance Sales:customer,product,purchase information. Manufacturing:management of supply chain. Human resources:employees,salaries.

1.1 What is a database system?

Page 8: Database System Concepts

1.1 What is a database system?

A database system is basically a computerized record-keeping system; i.e.,it is a computerized system whose overall purpose is to store information and to allow users to retrieve and update that information on demand.

A database system involves four major components:

data hardware software users

DBS=DB+DBMS+APPLICATION+DBA+USER

Page 9: Database System Concepts

employee

enrollment

1.Data

The data in the database—at least in a large system—will be

both integrated and shared.

name address department salary …

name course …

Example:

department

employee Personnel Department

Education Department

Use the employee information for different purpose

?

Page 10: Database System Concepts

1.Data

By integrated: we mean that the database can be thought of as a unification of several otherwise distinct files, with any redundancy among those files at least partly eliminated.

By shared: we mean that individual pieces of data in the database can be shared among different users, in the sense that each of those users can have access to the same piece of data, possibly for different purpose.

Page 11: Database System Concepts

2.Hardware

The hardware components of the system consist of:

1.The secondary storage volumes, device controllers, I/o channels, and so forth;and

2.The hardware processor(s) and associated main memory

Page 12: Database System Concepts

3.Software

Between the physical database itself—i.e.,

the data as physically stored—and the users

of the system is a layer of software, know

variously as the database manger or

database server or, most commonly,

the database management system(DBMS).

DBMS

DATABASE

OS

AS

…USER USER

All requests for access to the database are handled by the DBMS. One general function provided by the DBMS is thus the shielding of database users from hardware—level details.

Page 13: Database System Concepts

4.Users

① Application programmers: responsible writing database application programs in some programming language.

② End users: end users interact with the system from online workstations or terminals.

③ Database administrator(DBA): Schema definition storage Structure and access-method definition Schema and physical-organization modification Granting of authorization for data access Routine maintenance

Page 14: Database System Concepts

1.2 What is a database

It is customary to refer to the data in a database as “persistent”. We say that data in the database “persists” because, once it has been accepted by the DBMS for entry into the database in the first place, it can subsequently be removed from the database only by some explicit request to the DBMS,not as a mere side effect of some program completing execution.

A database is a collection of persistent data that is used by the application systems of some given enterprise.

Page 15: Database System Concepts

1.3 Purpose of database system

Keeping organizational information in a file—processing system has a number of major disadvantages.

1. Data redundancy and inconsistency

2. Difficulty in accessing data

3. Data isolation

4. Integrity problems

5. Atomicity problems

6. Concurrent—access anomalies

7. Security problems

Data are scattered in various files&files may be in different formats

Consistency constraintsExample:balance of bank>=$25

Page 16: Database System Concepts

1. Data redundancy and inconsistency

name address department salaryHayes Round Hidd Account 500

Johnson Perryridge Account 780

Smith Perryridge Loan 1200

name course departmentHayes OS Account

Johnson DB Account

Smith DS Loan

LoanHayes

Loan

Hayes

Account

?

employee

enrollment

inconsistency

Page 17: Database System Concepts

2. Difficulty in accessing data

Requirement:

Find out the names of all customers who live within wuhan.(the list of all customers)

resolvesExtract the needed information form the list of all customers

Write a new necessary application program

Find out the names of all customers who live within wuhan and have an account balance of $1000 or more.

Page 18: Database System Concepts

5. Atomicity problems

Account A

$500

Account B

$100

$50x

$50 $50$50$50

$50$50$50

$500-$50=$450 $100$50?

(1)

(2)

$50

Page 19: Database System Concepts

6. Concurrent—access anomalies

Husband $100Account A $500

Wife $50Read $500

$500-$50=$450

Write $450

Read $500

$500-$100=$400

Write $400

$400 / $450 XRead $450

$450-$100=$350

Write $350

Read $400

$400-$50=$350

Write $350

Page 20: Database System Concepts

1.3 Purpose of database system

Benefits of the database approach:

2. Redundancy can be reduced

3. Inconsistency can be avoided (to some extent)

4. Transaction support can be provided.

5. Integrity can be maintained6. Security can be enforced

7. Conflicting requirements can be balanced

8. Standards can be enforced

1. The data can be shared

Page 21: Database System Concepts

1.4 Database languages

A database system provides two different types of languages: one to specify the database schema, and the other to express database queries and updates.

Data-Definition Language Data-Manipulation Language

Database Language

Procedural DMLs Declarative DMLs

Page 22: Database System Concepts

1.5.1 The three levels

The internal level is the one closes to physical storage.

it is consists of many occurrences of each of many types of internal record.(internal schema)

The external level is the one closest to the users. it is consists of many occurrences of each of many types of external record. ( external schema)

The conceptual level is a level of indirection between the other two. it is consists of many occurrences of each of many types of conceptual record.(conceptual schema)

The ANSI/SPARC architecture is divided into three levels— internal, conceptual, and external

Page 23: Database System Concepts

1.5.1 The three levels

External level

(individual user views)

Conceptual level

(community user views)

Internal level

(storage views)

Fig 1.1 The three levels of the architecture

Internal Schema

Conceptual Schema

External schema

External schema

External schema

Page 24: Database System Concepts

1.5.1 The three levels

Example:

External(PL/I)

Conceptual

Internal

External(COBOL)DCL 1 EMPP,

2 EMP# CHAR(6),

2 SAL FIXED BIN(31);

01 EMPC.

02 EMPNO PIC X(6).

02 DEPTNO PIC X(4).

EMPLOYEE

EMPLOYEE NUMBER CHARACTER (6)

DEPARTMENT_NUMBER CHARACTER (4)

SALARY

STORED EMP BYTES=20

PREFIX TYPE=BYTE(6), OFFSET=0

EMP# TYPE=BYTE(6), OFFSET=6, INDEX=EMPX

DEPT# TYPE=BYTE(4), OFFSET=12

PAY TYPE=FULLWORD, OFFSET=16

Page 25: Database System Concepts

1.5.1 The three levels

Fig 1.2 Detailed system architecture

Page 26: Database System Concepts

1.5.2 Mappings

conceptual/internal mapping and several external/conceptual mappings :

1.the conceptual/internal mapping defines the correspondence between the conceptual view and the stored database; it specifies how conceptual records and fields are represented and the internal level.

2.an external/conceptual mapping defines the correspondence between a particular external view and the conceptual view.

Page 27: Database System Concepts

1.5.2 Mappings

Internal Schema

Conceptual Schema

External schema

External schema

External schema

conceptual/internal mapping

external/conceptual

Page 28: Database System Concepts

1.5.2 Mappings

Data independence:

1.physical data independence is the ability to modify the physical schema without causing application programs to be rewritten. (conceptual/internal mapping)

2.logical data independence is the ability to modify the logical schema without causing application programs to be rewritten. (external/conceptual)

Page 29: Database System Concepts

1.5.3 Instances and schemas

The overall design of the database is called the database schema.

The collection of information stored in the database at a particular moment is called an instance of the database.

database schema instance of the database int i i=2

sn name sex

01 carol female

03 bob malestudent

Student={sn,name,sex}

Page 30: Database System Concepts

1.6 Transaction Management

A transaction is a collection of operations that performs a single logical function in a database application.

Each transaction is a unit of both atomicity and consistency.

Atomicity Consistency Isolation Durability (ACID)

Page 31: Database System Concepts

1.7 The Database Management System

DBMS is the software that handles all access to the database.1.A user issues an access request, using some particular data sublanguage (SQL)

2.The DBMS intercepts that request and analyzes it

3.The DBMS inspects, in turn, the external schema for that user, the corresponding external/conceptual mapping, the conceptual schema,the conceptual/internal mapping,and the storage structure definition. 4.The DBMS execute the necessary operations on the stored database.

Page 32: Database System Concepts

1.7 The Database Management System

The functions of the DBMS :Data definition

Data manipulation

Optimization and execution

Data security and integrity

Data recovery and concurrency

Data dictionary

Performance

Page 33: Database System Concepts

Fig 1.3 major DBMS functions and components

Page 34: Database System Concepts

1.8 Application Architectures

A database system can be regarded as having a very simple two-part structure consisting of a server and a set of clients. The server is just the DBMS itself. The clients are various applications that run on top of the DBMS.

Page 35: Database System Concepts

1.9 Distributed processing

Distributed processing means that distinct machines can be connected together into a communication network such as internet ,such that a single data-processing task can span several machines in the network.

Page 36: Database System Concepts

Exercises:

1.Explain the following terms:

DBMS Data inconsistency Data view Data instance

Database schema Physical schema Logical schema

Physical data independence Logical data independence

2. P23 : 1.1 1.3 1.5 1.8