0% found this document useful (0 votes)
15 views68 pages

Ch1 Introduction

The document outlines the course 'Introduction to Database' taught by Huang Liping, detailing the syllabus, textbooks, and grading policy. It covers essential database concepts, including data models, SQL, database design, and the purpose of database systems. The course emphasizes the importance of understanding database management systems and their applications in various fields.

Uploaded by

yuuqoq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views68 pages

Ch1 Introduction

The document outlines the course 'Introduction to Database' taught by Huang Liping, detailing the syllabus, textbooks, and grading policy. It covers essential database concepts, including data models, SQL, database design, and the purpose of database systems. The course emphasizes the importance of understanding database management systems and their applications in various fields.

Uploaded by

yuuqoq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 68

Introduction to

Database
Software College
2018.3
Course Information
 Course
Name: Introduction to Database
( 数据库概论 )
 Teacher
Name: Huang Liping( 黄利萍 )
E-mail: huanglp@swc.neu.edu.cn

Course Information 2
Text Book and Reference
 Text Book
 Database System Concepts (6th Edition),
McGraw-Hill, 2010
 http://codex.cs.yale.edu/avi/db-book/

 Reference
 First Course in Database Systems,A
(3rd Edition), Prentice Hall , 2008
 数据库系统概论 ( 第 4 版 ) ,
高等教育出版社, 2007
Course Information 3
Contents and Requirements
 Basic Concepts Understand
 Data Model
 Relational Model Master Skillfully

 Database Language
 SQL Master Skillfully
 Database Programming
 Embedded SQL
 Triggers Master
 Stored Procedure
 ODBC, JDBC Understand
Course Information 4
Cont.
Contents and Requirements
 Database Design
 E-R Model Master Skillfully
 Transform Rule Master Skillfully
 Normalize Master
 DBMS Functions
 Query optimization
 Understand
Concurrency Control
 Recovery Systems
Course Information 5
Grading Policy
 Assignments: 30%
 Final Exam: 70%

May
May change
change ifif necessary
necessary

Course Information 6
Chapter 1
Introduction
Contents
 Purpose of Database Systems
 View of Data
 Database Languages
 Relational Databases
 Database Design
 Data Storage and Querying
 Transaction Management
 Database Architecture
 Database Users and Administrators
 Overall Structure
 History of Database Systems
Chapter1 8
Introduction
Database System
 Database System (DBS)
 Collection of interrelated data
Database
Database (DB):
(DB): contains
contains
information
information about
about aa particular
particular
enterprise
enterprise
 Set of programs to access the data
Database
Database Management
Management System
System
(DBMS)
(DBMS) :: Provide
Provide aa way
way to
to store
store and
and
retrieve
retrieve database
database information
information that
that is
is
both
both convenient
convenient and
and efficient
efficient
Like
Like OS,
OS, DBMS
DBMS is
is
aa system
system
Chapter1 software
software 9
Introduction
Hierarchical Architecture

User/
Application

DBM OS
S DB

Chapter1 10
Introduction
Database System
Applications
 Representative Database Applications
 Banking: all transactions
 Airlines: reservations, schedules
 Universities: registration, grades
 Sales: customers, products, purchases
 Online retailers: order tracking, customized
recommendations
 Manufacturing: production, inventory, orders, supply
chain
 Human resources: employee records, salaries, tax
deductions
 Databases touch all aspects of our lives

Chapter1 11
Introduction
Purpose of Database
Systems
 In the early days, applications were built

directly on top of file systems

 Using file systems to store and

manipulate data have several


drawbacks

Chapter1 12
Introduction
Purpose of Database
Cont.
Systems
 Drawbacks of using file system
 Data redundancy and inconsistency
 duplication of information in different files
Example
Fortran
Program
Program11Saving account

C
Customer Program
Programnn
Name Phone
number JAVA
Program m
Program mChecking
account
Banking
Application
Chapter1 13
Introduction
Purpose of Database
Cont.
Systems
 Drawbacks of using file systemCont.

 Difficulty in accessing data


 Need to write a new program to carry out each
new task Customer info
Example
Program
Program11

Names of all customer


Program
Programnn
who lives within
particular postal-code
area Program
Programm
m
Names of all customer
who is older than 50 Banking
Application
Chapter1 14
Introduction
Purpose of Database
Cont.
Systems
Cont.
 Drawbacks of using file system
 Data isolation — multiple files and formats
Example Saving account
Fortran
Program
Program11
Checking
account C
Program
Programnn
VIP customer Names of all VIP
JAVA customers who have a
Program m
Program m checking account

Program
Programpp
Banking
Application
Chapter1 15
Introduction
Purpose of Database
Cont.
Systems
 Drawbacks of using file system
Cont.
 Integrity problems
 Integrityconstraints (e.g. account balance > 0)
become “buried” in program code rather than
being stated explicitly
 Hard to add new constraints or change existing
ones

Chapter1 16
Introduction
Purpose of Database
Cont.
Systems
Cont.
 Drawbacks of using file system
 Atomicity of updates
 Failures
may leave data in an inconsistent state
with partial updates carried out
 Transferof funds from one account to another
should either complete or not happen at all
Example
200$ A
200$
100$
(200-100)$ China
100$ Bank
500$ B
(500+100 500$
600$ City Bank
)$ 600$ Chapter1 17
Introduction
Purpose of Database
Cont.
Systems
 Drawbacks of using file system
Cont.
 Concurrent access by multiple users
 Concurrent access is needed for performance
 Uncontrolledconcurrent accesses can lead to
inconsistencies
 Two people reading a balance and updating it at
the same time
Example 2000 2000
2000-500 2000 2000-300
1500 1700
Chapter1 18
Introduction
Purpose of Database
Cont.
Systems
Cont.
 Drawbacks of using file system
 Security problems
 Hard to provide user access to some, but not all,
data

Database
Database systems
systems offer
offer solutions
solutions
to
to all
all the
the above
above problems
problems

Chapter1 19
Introduction
View of data
 database system provide an abstract
view of the data
 Hide certain complexity details of how data
is stored and maintained
 Achieved through several level of
abstraction
 Physical level
 Logical level
 View level

Chapter1 20
Introduction
Level of Abstraction
 Physical level:
 describes how a record (e.g., customer) is stored
 Logical level:
 describes what data are stored in the database, and
the relationships among the data
 describe entire database
 View level:
 Describe part of the database
 A way to hide: (a) details of data types and (b)
information (such as an employee’s salary) for
security purposes
Chapter1 21
Introduction
Cont.
Level of Abstraction
Application
Application 11 Application
Application N
N Administrator
Administrator

View 1 View N View Level


DBMS

Logical Level
Physical Level

OS
OS (File
(File System)
System)

Secondary Memory
Chapter1 22
Introduction
Instances and Schemas
 Similar to types and variables in programming
languages
 Schema – the overall design of the database
 Analogous to type information of a variable in a
program
 Instance – the collection of information stored
in the database at a particular point in time
 Analogous to the value of a variable

Chapter1 23
Introduction
Cont.
Instances and Schemas
 Several Schemas of DBS
 Physical schema: database design
at the physical level
 Logical schema: database design at
the logical level
 Subschema: describe different views
at the view level

Chapter1 24
Introduction
Cont.
Instances and Schemas
 Physical Data Independence –
application do not depend on physical
schema, and thus need not be rewritten
if the physical schema changes
 Applications depend on the logical schema
 Physical schema is hidden beneath the
logical schema

Chapter1 25
Introduction
Data Models
 A collection of tools for describing
 Data
 Data relationships
 Data semantics
 Data constraints
 Provides a way to describe the design of
a database at the physical, logical and
view levels.

Chapter1 26
Introduction
Cont.
Data Models
 Relational model
 Entity-Relationship data model
 mainly for database design
 Object-based data models
 Object-oriented
 Object-relational

 Semistructured data model


 XML
 Other older models:
 Network model
 Hierarchical model
Chapter1 27
Introduction
Relational Model
 Use a collection of tables to represent
both data and relationships among
those data

Each
Each table
table has
has
several
several
columns
columns
Each
Each column
column
has
has aa unique
unique
name
name

Chapter1 28
Introduction
Chapter1 29
Introduction
The Entity-Relationship
Model
 Models an enterprise as a collection of
entities and relationships
 Entity: a “thing” or “object” in the real world
that is distinguishable from other objects
Each person, bank accounts,
customer
 Described by a set of attributes
Account: described by account_number,
balance
Customer: described by customer_name,
customer_street, customer_city,
Chapter1 customer_id 30
Introduction
The Entity-RelationshipCont.
Model
 Relationship: an association among
several entities
A deposit relationship associates a
customer with a account that she has

 Entity Set: the set of all entities of the


same type
 Relationship Set: the set of all
relationships of the same type
Chapter1 31
Introduction
The Entity-Relationship
Cont.
Model
 Represented diagrammatically by an
entity-relationship diagram:

Chapter1 32
Introduction
Database Languages
 Database system provides
 Data Definition Language (DDL) to specify
database schema
 Data Manipulation Language (DML) to
express database queries and updates
 In practice, DDL and DML form parts of a
single database language
 SQL (Structured Query Language)

Chapter1 33
Introduction
Data Definition Language
(DDL)
 Specification notation for defining the
database schema

Example
create table account (
account-number
char(10),
balance
integer)

Chapter1 34
Introduction
Data Definition Language
Cont.
(DDL)
 DDL compiler generates tables
according to DDL statements and store
the schema definitions of these tables in
data dictionary
 Data dictionary contains metadata (i.e.,
data about data)
 Database schema
 Integrity constraints
 Authorization

Chapter1 35
Introduction
Data Manipulation Language
(DML)
 Language for accessing and
manipulating the data organized by
the appropriate data model
Quer
 Retrieval of information y
 Insertion of new information
 Deletion of information
 Modification of information
 DML also known as query language

Chapter1 36
Introduction
Data Manipulation Language
Cont.
(DML)
 Two classes of languages
 Procedural – user specifies what data is
required and how to get those data
 Declarative (nonprocedural) – user
specifies what data is required without
specifying how to get those data
 SQL is the most widely used
nonprocedural query language

Chapter1 37
Introduction
SQL
Example
 Find the name of the customer with customer-id
192-83-7465

Select customer.customer_name
from customer
where customer.customer_id = ‘192-83-7465’

Chapter1 38
Introduction
Cont.
SQL
Example
 Find the balances of all accounts held by the
customer with customer-id 192-83-7465
select account.balance
from depositor, account
where depositor.customer_id = ‘192-83-7465’
and
depositor.account_number =

account.account_number

Chapter1 39
Introduction
Access from application
programs
 Application programs generally access
databases through one of
 Language extensions to allow embedded
SQL
 Application program interface (e.g.,
ODBC/JDBC) which allow SQL queries to
be sent to a database
Open JAVA
Database Database
Connectivity Connectivity
Chapter1 40
Introduction
Relational Databases
 A relational database is based on the
relational data model
 Data and relationships among the data
is represented by a collection of tables
 Includes both a DML and a DDL
 Most commercial relational database
systems employ the SQL query
language
Chapter1 41
Introduction
Database Tables
(Access)

Chapter1 42
Introduction
Database Design
 The process of designing the general

structure of the database:


 Logical Design

 Physical Design

Chapter1 43
Introduction
Cont.
Database Design
 Logical Design – Deciding on the database
schema. Database design requires that we
find a “good” collection of relation schemas.
 Business decision – What attributes should we
record in the database?
 Computer Science decision – What relation
schemas should we have and how should the
attributes be distributed among the various relation
schemas?
 Physical Design – Deciding on the physical
layout of the database

Chapter1 44
Introduction
Tools:
Database Design
SQL (queries)
Programming

Program
Design

SQL
Best:
Spend your time
on design and SQL.
Program
Design

SQL

Worst:
Compensate for poor design
and limited SQL with programming.

Chapter1 45
Introduction
Database Users
Users
Users are
are differentiated
differentiated byby the
the way
way
they
they expect
expect to
to interact
interact with
with the
the
system
system
 Application programmers – interact
with system through DML calls
 Sophisticated users – form requests
in a database query language

Chapter1 46
Introduction
Cont.
Database Users
 Specialized users – write specialized
database applications that do not fit into
the traditional data processing
framework
 Naive users – invoke one of the
permanent application programs that
have been written previously
 Examples, people accessing database over
the web, bank tellers, clerical staff

Chapter1 47
Introduction
Database Administrator
 Database Administrator  DBA
 A person who have central control of the
database system, coordinates all the
activities of the database system
 Has a good understanding of the
enterprise’s information resources and
needs

Chapter1 48
Introduction
Cont.
Database Administrator
 Database administrator's duties include:
 Schema definition
 Storage structure and access method definition
 Granting user authority to access the database
 Specifying integrity constraints
 Acting as liaison with users
 Monitoring performance and responding to changes
in requirements

Chapter1 49
Introduction
Database System Structure

 Function components of DBMS

 Storage Management

 Query Processing

Chapter1 50
Introduction
Storage Management
 Database data is typically stored on
secondary memory (hard disk), using
file system
 Storage Manager is a program module
responsible to
 Interact with the file sytem
 Efficient storing, retrieving and updating of
data

Chapter1 51
Introduction
Cont.
Storage Management
 Storage Manager include following
components
 Authorization and integrity manager
 Transaction manager
 File manager
 Buffer manager

Chapter1 52
Introduction
Cont.
Storage Management
 Authorization and integrity manager
 Tests for the satisfaction of integrity
constraints and check the authority of users
to access data
 Transaction manager
 Ensure database remains in a consistent
state despite system failure
 Ensure concurrent transaction execution
proceed without conflicting
Chapter1 53
Introduction
Cont.
Storage Management
 File manager
 Allocate space on disk storage
 Manage data structures used to represent
information stored on disk
 Buffer manager
 Fetch data from disk storage to main
memory
 Decide what data to cache in main memory

Chapter1 54
Introduction
Cont.
Storage Management
 Storage Manager implements following
data structures
 Data File: store database itself
 Data Dictionary: store metadata about the
structure of database, in particular the
schema of database
 Indices: provide fast access to data items
that hold particular value

Chapter1 55
Introduction
Query Processing
 One of the main purpose of DBS is to simplify
and facilitate access to data
 DBS achieve this goal by
 Data abstraction
 Nonprocedural language
 Query Processor translates updates and
queries written in a nonprocedural language,
at the logical level, into an efficient sequence
of operations at the physical level

Chapter1 56
Introduction
Cont.
Query Processing
 Query processor components include

 DDL Interpreter

 DML Compiler

 Query Evaluation Engine

Chapter1 57
Introduction
Cont.
Query Processing
 DDL interpreter
 Interprets DDL statement and record
definitions in the data dictionary
 DML Compiler
 Translate DML statement into an evaluation
plan consisting low-level instructions
 Query evaluation engine
 Executes low level instructions generated
by DML compiler

Chapter1 58
Introduction
Cont.
*Query Processing
 Alternative ways of evaluating a given query
 Equivalent expressions
 Different algorithms for each operation
 Cost difference between a good and a bad
way of evaluating a query can be enormous
 Need to estimate the cost of operations
 Depends critically on statistical information about
relations which the database must maintain
 Need to estimate statistics for intermediate results
to compute cost of complex expressions
Chapter1 59
Introduction
*Steps of query
processing
1.Parsing and translation
2.Optimization
3.Evaluation

Chapter1 60
Introduction
Transaction Management
 A transaction is a collection of operations
that performs a single logical function in a
database application
 Transaction-management component
ensures that the database remains in a
consistent (correct) state despite system
failures (e.g., power failures and operating
system crashes) and transaction failures.
 Concurrency-control manager controls the
interaction among the concurrent
transactions, to ensure the consistency of the
database

Chapter1 61
Introduction
Naïve Applicati
on Sophisticat DBA
Overall System Structure
users Program
mer
ed users

Applicati Applicati
on on Query Administrat
interface program tools ion tools
s
Applicatio
Applicatio Compiler
nn and DML
DML DDL
program
program linker queries
queries interpreter
object
object
code
code Query DML
evaluation compiler
engine and Query
organizer Processor
Transacti Authorizati
Buffer File on and
manager manager on
manager Database
integrity
Manageme
manager
nt System
Storage
Manager
Data dictionary
Data indices
Statistical
Chapter1 data Disk62
Introduction Storage
Database Architecture
 The architecture of a database systems
is greatly influenced by the underlying
computer system on which the database
is running
 Centralized
 Client-server
 Parallel (multi-processor)
 Distributed

Chapter1 63
Introduction
History of Database Systems
 1950s and early 1960s:
 Data processing using magnetic tapes for storage
 Tapes provide only sequential access
 Punched cards for input
 Late 1960s and 1970s:
 Hard disks allow direct access to data
 Network and hierarchical data models in widespread
use
 Ted Codd defines the relational data model
 Would win the ACM Turing Award for this work
 IBM Research begins System R prototype
 UC Berkeley begins Ingres prototype
Chapter1 64
Introduction
Cont.
History of Database Systems
 1980s:
 Research relational prototypes evolve into
commercial systems
 SQL becomes industrial standard
 Parallel and distributed database systems
 Object-oriented database systems
 1990s:
 Large decision support and data-mining applications
 Large multi-terabyte data warehouses
 Emergence of Web commerce
Chapter1 65
Introduction
Conclusions

Chapter1 66
Introduction
Questions?

Chapter1 67
Introduction
END of CHAPTER 1

Chapter1 68
Introduction

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy