27
Database Principles Database Principles LiaoNing ShiHua University

Database Principles LiaoNing ShiHua University. 1.2A First Course In Database Systems Textbooks Required: A First Course in Database Systems,2nd, by

Embed Size (px)

Citation preview

Database PrinciplesDatabase Principles

LiaoNing ShiHua University

1.2A First Course In Database Systems

TextbooksTextbooks

Required: A First Course in Database Systems,2nd, by Jeffrey

D.Ullman Jennifer Widom. Recommended:

王珊 ,萨师煊 . 数据库系统概论 (第四版 ). 高等教育出版社 , 2006 年

Books on SQL Server 2000 or 2005 You may also want:

Books on design and programming : Powerbuilder, PowerDesigner, UML, VB, Delphi, VC, JAVA, C#, ASP, PHP, JSP etc.

1.3A First Course In Database Systems

Why Using English Textbook ?Why Using English Textbook ?

More computer English words

More advanced and newest information

Better information retrieval capability

More international communication chance

1.4A First Course In Database Systems

What to learn in this unit ?What to learn in this unit ?

Basic theories (basic)

System and database design (designer)

Application Programming (programmer)

Database management and maintenance (database manager)

1.5A First Course In Database Systems

SyllabusSyllabus

Background and history of database management systems

Fundamentals of using a database management systems: SQL Server2000.

Database modeling

Relational model: theoretical background and operations

Database Language SQL

Fundamentals of database management systems: transactions and security etc.

Database system design and practice

Chapter 1Chapter 1The Worlds of Database SystemsThe Worlds of Database Systems

Evolution of Database Systems

Architecture of DBMS and DBS

Future of Database Systems

1.7A First Course In Database Systems

1.1 Evolution of Database Systems1.1 Evolution of Database Systems

1.1.1 Some Basic notionsData

Database (DB)

Database Management System (DBMS)

Database System (DBS).

Database Administrator (DBA)

1.8A First Course In Database Systems

Basic NotionsBasic Notions

Data Distinct pieces of information represented in a form suitable

for processing by computer.

Data can exist in a variety of forms -- as digital numbers, text, image, sound, video and etc.

Database (DB) In essence, it’s nothing more than a collection of information

that exists over a long period of time.

In common parlance, it refers to a collection of data managed by a database management system (DBMS) or just database system (DBS).

1.9A First Course In Database Systems

Example of Data and DatabaseExample of Data and Database

1.10A First Course In Database Systems

Another example: University DatabaseAnother example: University DatabaseSid Sname Ssex Sage sdept

0121001 Tom M 21 Cs

0121002 Mary F 20 Cs

0121025 Jack M 18 Cs

0110033 Smith M 19 Ma

0211010 Alane F 22 Is

cid Cname credit

1 Programming

4

2 English 63 Physics 44 Dbms 4

sid cid grade

0121002 4 920121002 3 880110033 1 700211010 1 850121002 2 95

Students

Courses Enrolled

1.11A First Course In Database Systems

DBMSDBMS

Database Management System (DBMS) A collection of programs that enables you to store,

modify, and extract information from a database.

There are many different types of DBMSs, ranging from small systems that run on personal computers to huge systems that run on mainframes.

1.12A First Course In Database Systems

Basic functions of DBMSBasic functions of DBMS

Data definition Allow creating new databases and specify their schema (logical

structure of the data), via data definition language (DDL).

Data manipulation Allow efficient access to the data, such as querying and modifying

the data, via query language or data manipulation language (DML).

Operation management of DB Support the storage of very large amounts of data over a long

period of time, assuring data integrity, keeping data secure from accident or unauthorized use. Support concurrent, atomic access to data.

Creation and maintenance of DB Such as inputting and transferring of Data, DB backup and

recovery, performance monitoring, audit and analysis etc.

1.13A First Course In Database Systems

Database System Database System (DBS)(DBS)

Database System (DBS). DB, DBMS, Development Tools, DB applications, DB Administrator (DBA)

and users

DB

OS

DBMS

Developing Tools

DB applications

User User

DBA Hardware

Operating System

DBMS, Compiling System

Developing Tools

Application Systems

DBMS in Computer System

1.14A First Course In Database Systems

Database AdministratorDatabase Administrator

DBAPerson who is responsible for management and

maintenance of DB.

TasksDatabase contents and structures

Storage structure and access methods

Database security and integration

Monitor and improve database performance

1.15A First Course In Database Systems

1.1.2 History of Data management1.1.2 History of Data management

File systems Problems: limited support to definition of data schema, no directly support to

DML (Data Manipulate Language), no support to efficient concurrent, secure access etc.

Early DBMS The first commercial DBMS appeared in the late 1960’s, evolved from file

systems.

The early DBMS’s used several data models for describing structure of DB: hierarchical model and network model.

Problems: no support to high-level query languages.

1.16A First Course In Database Systems

History of Data management (cont.History of Data management (cont. ))

Relational DBMS A famous paper by Ted Codd in 1970, “A relational model for large

shared data banks” in Comm. ACM.

Data organized as tables called relations.

Unlike the user of early DBS, user of a relational system won’t be concerned with the storage structure, and queries are expressed in a very high-level language (SQL).

Today used in most DBMS's.

1.17A First Course In Database Systems

Relational ModelRelational Model

Based on tables, such as:

acct # name balance

12345 Sally 1000.21

34567 Sue 285.48

… … …

Attributes(column headers)

Tuples(rows)

1.18A First Course In Database Systems

Query LanguagesQuery Languages

Employee

Name Dept

Department

Dept Manager

SELECT ManagerFROM Employee, DepartmentWHERE Employee.name = "Clark Kent”

AND Employee.Dept = Department.Dept ;

1.19A First Course In Database Systems

History of Data ModelHistory of Data Model Data model:

abstraction of data features in real world into computer world.

Hierarchical model

60’s

70's

80's

90’s

now

Relational modelChoice for most new

applications

Object Bases model Knowledge Bases model

Network model

1.20A First Course In Database Systems

Relational model or not?Relational model or not?

Relational model is good for: Large amounts of data —> simple operations Navigate among small number of relations

Difficult Applications for relational model: VLSI Design (CAD in general) CASE: Computer-Aided Software Engineering Graphical Data

Where number of "relations" is large, relationships are complex Object Data Model Logic Data Model

1.21A First Course In Database Systems

Other Data ModelsOther Data Models

Object data model Usually find objects via explicit navigation, also query

language in some systems Complex Objects – Nested Structure (pointers or

references) Encapsulation, set of Methods/Access functions Object Identity Inheritance – Defining new classes like old classes

Logic data model Prolog, Datalog More power than relational

1.22A First Course In Database Systems

The DBMS MarketplaceThe DBMS Marketplace

Relational DBMS companies – Oracle, SybaseOracle, Sybase – are among the largest software companies in the world.

IBM offers its relational DB2DB2 system. With IMS, a nonrelational system, IBM is by some accounts the largest DBMS vendor in the world.

Microsoft offers SQL-ServerSQL-Server, plus Microsoft AccessMicrosoft Access for the cheap DBMS on the desktop, answered by “lite” systems from other competitors.

Relational companies also challenged by “object-oriented DB” companies.

But countered with “object-relational” systems, which retain the relational core while allowing type extension as in OO systems.

1.23A First Course In Database Systems

1.2 Architecture of DBMS1.2 Architecture of DBMS

Major components of a DBMS

DataMetadata

Storage Manager

Query Processor

TransactionManager

SchemaModifications

Queries Modifications

Schema (logical structure of the data); Metadata(data of data)

1.24A First Course In Database Systems

Architecture of DBSArchitecture of DBSThree Schema Architecture of DBS External Schema: user schema or subschema

Defines one view of the data as seen by a specific set of application or end users.

There may be many external schemas in a DB.

Schema: conceptual schema, logical schema Defines data from perspective systems designer; Independent of end users & data storage mechanism There is only one conceptual schema in a DB.

Internal Schema: storage schema Defines how data is organized, stored and manipulated inside the

system. Totally dependent on particular implementation. There is only one internal schema in a DB.

1.25A First Course In Database Systems

Three Schema Architecture (cont.)Three Schema Architecture (cont.)

Application

A

External Schema 1

Schema

Internal Schema

DB

Application

B

Application

D

Application

E

Application

C

External Schema 2

External Schema 3

1.26A First Course In Database Systems

Independence of Data and ProgramIndependence of Data and Program

Logical IndependenceVia Reflection of External Schema/SchemaOne Schema corresponds to many External schemas;

every Ex-Schema has an Ex-Schema/Schema Reflection.When Schema changes, DBA changes the

Ex-Schema/Schema reflections, so application programs needn’t been changed.

Physical IndependenceVia Reflection of Schema/Internal SchemaSchema/Internal Schema Reflection is unique.When Internal Schema changes, DBA changes the

Schema/ Internal Schema Reflection, so application programs needn’t been changed.

1.27A First Course In Database Systems

Three Aspects to Studying DBMS'sThree Aspects to Studying DBMS's

Modeling and design of databasesAllows exploration of issues before committing to an

implementation.

Application programmingSQL: queries and DB operations like update.

Host language and Embedded SQL

DBMS implementationStorage, query processing, transaction, …