1_DatabaseSystem-Overview
1_DatabaseSystem-Overview
Overview
Chapter 1
Contents
1 Basic concepts
2 File-based Approach and Database Approach
3 Three-Schema Architecture and Data Independence
4 Database Languages
5 Data Models, Database Schema, Database State
6 Data Management Systems Framework
2
Contents
1 Basic concepts
2 File-based Approach and Database Approach
3 Three-Schema Architecture and Data Independence
4 Database Languages
5 Data Models, Database Schema, Database State
6 Data Management Systems Framework
3
Basic concepts
Data and information
Database
Database management system (DBMS)
Application program
Types of database applications
4
Data and Information
Data
Known facts that can be recorded and that have implicit
meaning
Information
Result of analyzing and interpreting pieces of data
Knowledge? Wisdom?
More: www.whatis.com
5
Data
308
6
Information
Đà Lạt
308
QL20
Tp. Hồ Chí Minh
Đvt: km
7
Knowledge - Wisdom
Data: 308
Information: 308 km
Knowledge: “308 km is a quite far distance”
Wisdom: “It’s very difficult to walk 308 km by any
person, but vehicle transport is OK”
8
Database
Collection of related data with an
implicit meaning
Represents some aspect of the real
world (miniworld)
Designed, built, and populated with
data for a specific purpose.
UNIVERSITY database
Information concerning students, lecturers, courses, and
grades in a university environment.
Data records: STUDENT, LECTURER, COURSE,
SECTION, GRADE_REPORT, PREREQUISITE
9
Database management system (DBMS)
Collection of programs to create and maintain a
database
Application programs
11
Types of database applications
Traditional database: textual or numeric
information
Multimedia database:
images, audio clips, and
video streams
Spatial database: geometric
objects
Geographic information
systems (GIS): store and
analyze maps, weather data,
and satellite images
Temporal database: historical data
12
Types of database applications (cont.)
Big data storage systems, or NOSQL systems:
Manage data for social media applications.
Cloud storage
Users are provided with storage capabilities on the Web.
Data warehouses and online analytical processing
(OLAP) systems:
Extract and analyze useful business information from very
large databases
Support decision making
Real-time and active database technology
Control industrial and manufacturing processes
13
Contents
1 Basic concepts
2 File-based Approach and Database Approach
3 Three-Schema Architecture and Data Independence
4 Database Languages
5 Data Models, Database Schema, Database State
6 Data Management Systems Framework
14
File-based Approach
Data is stored in one or more separate computer files
Data is then processed by computer programs -
applications
15
File-based Approach
Data entry File handling
and routines
Sales files
Reports File definition
Sales Department Sales Application Programs
Sales files
PrivateOwner (ownerNo, fName, lName, address, telNo)
PropertyForRent (propertyNo, street, postcode, rooms, ownerNo)
Client (clientNo, fName, lName, address, telNo, prefType, maxRent)
Lease (leaseNo, propertyNo, clientNo, deposit, paid, Start, Finish)
PropertyForRent (propertyNo, street, city, postcode, rent)
Client
16 (clientNo, fName, lName, address, telNo) Contract files
File-based Approach
Problems:
Data Redundancy
• The same information being kept in several different places
(files)
• Wastes storage space and duplicates effort
Data Inconsistency
• Various copies of the same data are conflicting
• Inconsistency in data format
17
File-based Approach PropertyForRent
File
Lease
File
Data entry File handling
and routines PropertyForRent
Reports File definition File
Contract Department Contract Application Programs Client
File
18
Shared File Approach
PrivateOwner
File
Data entry File handling
and routines
Reports File definition
Sales Department PropertyForRent
Sales Application Programs
File
Client
File
19
File-based Approach
Shared File Approach
Data (files) is shared between different applications
Data redundancy problem is alleviated
Data inconsistency problem across different versions of the
same file is solved
20
File-based Approach
Shared File Approach
Other problems:
• Rigid data structure: If applications have to share files, the file
structure that suits one application might not suit another
• Physical data dependency: If the structure of the data file needs
to be changed in some way, this alteration will need to be
reflected in all application programs that use that data file
• No support of concurrency control: While a data file is being
processed by one application, the file will not be available for
other applications or for ad hoc queries
21
Database Approach
Arose because:
Definition of data was embedded in application programs,
rather than being stored separately and independently
No control over access and manipulation of data beyond
that imposed by application programs
Result:
The Database and Database Management System (DBMS).
22
Database Approach
23
A Simplified Database System Environment
24
Database Approach
System catalog (metadata) provides description of
data to enable program–data independence
Logically related data comprises entities, attributes,
and relationships of an organization’s information
DataBase Management System (DBMS): a general-
purpose software system that facilitates the processes
of defining, constructing, manipulating, and sharing
databases among various users and applications
25
Database Approach
Database approach allows user:
Specify data types, structures and any data constraints to
be stored in the database. All specifications are stored in
the database
Query data: retrieve (query), update (insert, delete,
modify)
Control access to database:
• a security system
• an integrity system
• a concurrency control system
• a recovery control system
• a user-accessible catalog
26
Database Approach
Roles in the Database Environment
Database Administrator (DBA)
Database Designers
Application Programmers
End Users
27
Database Approach
Database administrators (DBA) are responsible for:
Authorizing access to the database
Coordinating and monitoring its use
Acquiring software and hardware resources
Database designers are responsible for:
Identifying the data to be stored
Choosing appropriate structures to represent and store this
data
28
Database Approach
Application programmers
Implement these specifications as programs
End users
People whose jobs require access to the database
29
Database Approach
Workers behind the Scene
DBMS system designers and implementers
• Design and implement the DBMS modules and interfaces as a
software package
Tool developers
• Design and implement tools
Operators and maintenance personnel
• Responsible for running and maintenance of hardware and
software environment for database system
30
Database Approach
DBMS components:
31
Database Approach
Characteristics of the Database Approach
Self-describing nature of a database system
Insulation between programs and data, and data
abstraction
• Program-data independence + Program-operation
independence = Data abstraction
• A data model is a type of data abstraction
Support of multiple views of the data
Sharing of data and multi-user transaction processing
32
When Not to Use a DBMS
More desirable to use regular files for:
Simple, well-defined database applications not expected to
change at all
Stringent, real-time requirements that may not be met
because of DBMS overhead
Embedded systems with limited storage capacity
No multiple-user access to data
33
Database Approach
History of database systems
First generation: Hierarchical and Network
Second generation: Relational
Third generation: Object-Relational, Object-Oriented
34
Example of Network Model Schema
35
Example of Relational Model Schema
36
Contents
1 Basic concepts
2 File-based Approach and Database Approach
3 Three-Schema Architecture & Data Independence
4 Database Languages
5 Data Models, Database Schema, Database State
6 Data Management Systems Framework
37
Three-Schema Architecture and Data Independence
38
Three-Schema Architecture and Data Independence
External Level
Users’ view of the database
Describes that part of database that is relevant to a
particular user
Conceptual Level
Community view of the database
Describes what data is stored in database and relationships
among the data
Internal Level
Physical representation of the database on the computer.
Describes how the data is stored in the database
39
Three-Schema Architecture and Data Independence
40
Three-Schema Architecture and Data Independence
Data Independence: is the capacity to change the
schema at one level of a database system without
having to change the schema at the next higher levels
Logical Data Independence:
Conceptual schema changes (e.g. addition/removal of
entities) should not require changes to external schema or
rewrites of application programs
Physical Data Independence:
Internal schema changes (e.g. using different file
organizations, storage structures/devices) should not
require changes to conceptual or external schemas
41
Three-Schema Architecture and Data Independence
42
Three-Schema Architecture and Data Independence
Objectives of Three-Schema Architecture
All users should be able to access same data
Users should not need to know physical database storage
details
DBA should be able to change database storage structures
without affecting the users’ views
Internal structure of database should be unaffected by
changes to physical aspects of storage
DBA should be able to change conceptual structure of
database without affecting all users
43
Contents
1 Basic concepts
2 File-based Approach and Database Approach
3 Three-Schema Architecture and Data Independence
4 Database Languages
5 Data Models, Database Schema, Database State
6 Data Management Systems Framework
44
Database Languages
Data Definition Language (DDL) allows the DBA or
user to describe and name entities, attributes, and
relationships required for the application plus any
associated integrity and security constraints
Data Manipulation Language (DML) provides basic
data manipulation operations (select, insert, update,
delete) on data held in the database
Data Control Language (DCL) defines activities that
are not in the categories of those for the DDL and DML,
such as granting privileges to users, and defining when
proposed changes to a databases should be irrevocably
made
45
Database Languages
Procedural DML allows user to tell system exactly how
to manipulate data (e.g., Network and hierarchical
DMLs)
Non-Procedural DML (declarative language) allows
user to state what data is needed rather than how it is
to be retrieved (e.g., SQL, QBE)
Fourth Generation Languages (4GLs)
Non-procedural languages: SQL, QBE, etc.
Application generators, report generators, etc. (see [2])
46
Contents
1 Introduction
2 File-based Approach and Database Approach
3 Three-Schema Architecture and Data Independence
4 Database Languages
5 Data Models, Database Schema, Database State
6 Data Management Systems Framework
47
Data Models, Database Schema and Database State
Data Model: An integrated collection of concepts for
describing data, relationships between data, and
constraints on the data in an organization
Categories of data models include:
Object-based (Conceptual)
• ER, Object-Oriented, … Describe data at
the conceptual &
Record-based (Representational) external levels
• Relational, Network, Hierarchical
Physical: used to describe data at the internal level
48
Data Models, Database Schema and Database State
Database Schema: the description of a database, which
is specified during database design and is not expected
to change frequently
Schema Diagram: a displayed schema
Database State (Snapshot, Instance): the data in the
database at a particular moment in time
49
Relational Database Schema
50
51
Database state
Contents
1 Basic concepts
2 File-based Approach and Database Approach
3 Three-Schema Architecture and Data Independence
4 Database Languages
5 Data Models, Database Schema, Database State
6 Data Management Systems Framework
52
Data Management Systems Framework
Layer 1: DB technologies
DB Systems, Distributed DB Systems
53
Data Management Systems Framework
Extending database capabilities for new applications
Example applications: storage and retrieval of images,
videos, data mining (large amounts of data need to be
stored and analyzed), spatial databases, time series
applications, …
More complex data structures than relational
representation
New data types except for the basic numeric and character
string types
New operations and query languages for new data types
New storage and retrieval methods
New security mechanisms
…
54
New database applications
Big data storage systems, or NOSQL systems:
Manage data for social media applications.
Cloud storage
Users are provided with storage capabilities on the Web.
Data warehouses and online analytical processing
(OLAP) systems:
Extract and analyze useful business information from very
large databases
Support decision making
Real-time and active database technology
Control industrial and manufacturing processes
55
Contents
1 Basic concepts
2 File-based Approach and Database Approach
3 Three-Schema Architecture and Data Independence
4 Database Languages
5 Data Models, Database Schema, Database State
6 Data Management Systems Framework
56
57