Fu n d a me n t a l s o f a D a t a b a s e S y s t e m
CH A PT E R O NE
I n t ro d u c ti on t o Da ta b as e S y s t e ms
1 What is a Database?
Database:a collection of organized data used by the applications/systems of an organization.is a collection
of interrelated data/files.
A database consists of:
Data
Relationships between the data
Constraints on the data – or restrictions e.g. Quantity must be greater than 0
A schema – describes all the objects in the database (e.g. a table has columns, a column has a data-
type and a size)
So we can say that a database is a self-describing collection of data elements, and relationships between
those elements.
a database has the following implicit properties:
It represents aspects of a real world.
It is collection of coherent (related) data.
It is designed, built and populated to address a specific situation in real world.
Database Management System (DBMS) is then a tool for creating and managing this large
amounts of data efficiently and allowing it to persist for a long periods of time. Hence DBMS is a
general-purpose software that facilities the processes of defining, constructing, manipulating, and
sharing database.
- Defining: involves specifying data types, structure and constraints.
- Constructing: is the process of storing the data into a storage media.
- Manipulating: is retrieving and updating data from and into the storage.
- Sharing: allows multiple users to access data.
The phrase “Database System” is used to colloquially refer to database and database management
system (DBMS).
Database System versus File System
The traditional file processing system is file-directory structure supported by a conventional
operating system. A file system organization of data lucks a number of major features of a
database system, such as:
Data redundancy and inconsistency: It is more likely that files and applications in a file system
to be of different format and standards. Moreover, same information may exist in duplicate.
Difficulty in accessing data: It does not support convenient and efficient responsive data-retrieval
system for new request in an existing data.
Data isolation: Related data may be scattered across files.
Integrity problems: Maintaining constraints across files and applications would be
difficult.
Atomicity problems: In case of all-or-none set of operations it is crucial that, if a failure occurs
the data need to be restored to its consistent state. That is the set of operations must be performed
as a single unified operation.
Concurrent access anomalies: Supervision of application is difficult to provide because data
may be accessed by any of the programs that are not coordinated.
Security problems: Adding application programs to the system in ad hoc fashion makes the
system more vulnerable to security treats and attacks.
Database System Architecture
Centralized Database System Architecture
Centralized database systems are those that run on a single computer system and that do not
interact with the other computer system except for displaying information on display terminals.
Such database systems span from single-user database system that run on a single personal
computer to a high-performance database systems that run on a main frame.
Client/Server Architecture for a Database System
In the Client/Server architecture the client processes run separately from the server processes,
usually on a different computer. The architecture enables to specialized servers and
workstations (clients). The general structure of client/server architecture is shown below.
Client Client Client Client
Web Server Mail Server DBMS Server
Fig 1. Structure of client/server architecture
Two-Tier Client/Server Architecture: is the simplest client/server application. In this
architecture the client processes provide an interface for the user, and gather and present data
usually either on a screen on the user's computer or in a printed report. The server processes
provide an interface with the data storage. The logic that validates data, monitors security and
permissions, and performs other business rules can be fully contained on either the client or the
server, or partly on the client and partly on the server. The exact division of the logic varies
from system to system.
The logic for the application can also be designed to form a separate middle tier. Applications
that are designed with separate middle tier have three logical tiers but still run into two physical
tiers. The middle tier may be contained in either the client or the server. Client/server
applications that are designed to run the user and business tiers of the application on the client
side, and the data tier on the server side are known as fat client applications. On the other hand,
applications that are designed to run the user tier on the client side and the business and data
tiers on the server side are known as thin client applications. Though fat and thin client/server
architectures have three tiers, such applications are intended to run on two computers as two
physical tiers. If the three tiers are separated so that the application can be run on three separate
computers, the implementation is known as a three-tier application.
Three-Tier Client/Server Architecture is an application that has three modularly separated tiers
that can be run on three machines. The standard model for a three-tier application has User tier
(GUI or Web Interface), Business tier (Application Server or Web Server) and Data tier (Data
Server).
User tier presents the user interface for the application, displays data and collects user
input. It also sends and requests for data to the next tier. It is often known as the
presentation tier.
The business tier incorporates the business rules for the application. It receives requests for
data from the user tier, evaluates them against the business rules and passes them on to the
data tier. It then receives data from the data tier and passes back to the user tier. It is also
known as the business logic tier.
And finally at the base, the data tier comprises the data storage and a layer that passes data
from the data storage to the business tier and vice versa. It is also known as the data tier.
Client
Web Server
Data Server
Fig 2. Logical three-tier client/server architecture for a web application
Co mp o n e n t s an d F u n c ti on a l i ti es of a D a t a b a s e S ys t e m
A database system can be partitioned into two modules as storage manager and query processor.
Storage manager: is a program module that provides interface between the low level data stored in
the database and the application programs or queries submitted to the system. The storage
manager translates the various DML statements into low level file system commands (the
conventional operating system commands); this it is responsible for storing, retrieving and
updating data.
The main components of the storage manager are:
Authorization and integrity manager: checks for credentials of the users and tests for the
integrity constraints.
Transaction Manager: enables to preserve consistency despite system failure and avoid
conflict at the time of concurrent transaction.
File manager: manages disk storage allocation and data structure for stored data.
Buffer manger: is responsible for fetching data from disk storage to the main memory.
Query Processor: is a module that handles queries as well as requests for modification of
the data and metadata. Some of the components are:
DDL interpreter (compiler): processes DDL statements for schema definition (meta-data)
and records the definitions in the data dictionary.
DML compiler: analyze, translates and optimizes DML statements in a high-level query
language into an evaluation plan consisting of low-level instructions codes to the query
evaluation (execution) engine.
Query evaluation engine: execute low-level instructions generated by the DML compiler.
The components of general database management system can be summarized in the figure shown
below.
Application Application Query Tools Administration
Tools
Interfaces Programs
Compiler and DML Queries DML Queries
Linker
Application
Program Object DML Compiler DDL Interpreter
Code and Organizer
Query Evaluation
Query Processor Engine
Authorization Transaction
Storage Manager Buffer Manager File Manager and Integrity Manager
Manager
Disk Storage
Indices Data Dictionary
Data Statistical Data
Fig 3. Database System Structure
Why use databases
Some reasons:
To organize information
To be able to get reports from data
To protect data – the security features of a database allow you to specify who has access, what data
they can see and what they can do with the data
To be able to share data