Docsity

Database Systems: Concepts, Types, and Applications, Lecture notes of Database Management Systems (DBMS)

Toggle sidebar
bg1
1
Masinde Muliro University of Science and technology
Computer Science Department
BIT 213: Introduction to Database System Notes
1.0 OVERVIEW OF DATABASE SYSTEMS
Data management, which focuses on data collection, storage and retrieval, constitutes
a core activity for any organisation.
To generate relevant information efficiently you need quick access to data (raw facts)
from which the required information is produced.
Efficient data management requires the use of a computer database. A database is a
shared, integrated computer structure that houses a collection of: -
i. End -user data i.e. raw facts of interest to the user.
ii. Meta -data i.e. raw facts of interest to the user
iii. Meta data i.e. data about data through which the data is integrated. The Meta
data provides a description of the data characteristics and the set of relationships
that link the data found within the database. The database resembles a very well
organized electronic filing cabinet in which powerful software referred to as
DBMS helps manage the cabinet’s contents.
1.1 Review Of Traditional Processing And It’s Limitations
Consider a saving bank enterprise that keeps information about all customers and
savings accounts in permanent system files at the bank.
The bank will need a number of applications e.g.
i. Program to debit or credit an account
ii. A program to add a new account
iii. A program to find the balance of an account
iv. A program to generate monthly statements
v. Any new program would be added as per the banks requirements
Such a typical filing /processing system has the limitation of more and more files and
application programs being added to the system at any time. Such a scheme has a
number of major disadvantages:
i. Data redundancy and inconsistency - Since the files and application
programs are created by different programmers over a long period of type, the
files are likely to have different formats and the programs may be written in
several programming languages. Moreover, the same piece of information may
be duplicated in several files. This redundancy leads to higher storage and
access costs. It may also lead to inconsistency i.e. the various copies of the
same data may no longer agree.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28

Partial preview of the text

Download Database Systems: Concepts, Types, and Applications and more Lecture notes Database Management Systems (DBMS) in PDF only on Docsity!

Masinde Muliro University of Science and technology

Computer Science Department

BIT 213: Introduction to Database System Notes

1.0 OVERVIEW OF DATABASE SYSTEMS

 Data management, which focuses on data collection, storage and retrieval, constitutes a core activity for any organisation.  To generate relevant information efficiently you need quick access to data (raw facts) from which the required information is produced.  Efficient data management requires the use of a computer database. A database is a shared, integrated computer structure that houses a collection of: -

i. End -user data i.e. raw facts of interest to the user. ii. Meta -data i.e. raw facts of interest to the user iii. Meta data i.e. data about data through which the data is integrated. The Meta data provides a description of the data characteristics and the set of relationships that link the data found within the database. The database resembles a very well organized electronic filing cabinet in which powerful software referred to as DBMS helps manage the cabinet’s contents.

1.1 Review Of Traditional Processing And It’s Limitations

 Consider a saving bank enterprise that keeps information about all customers and savings accounts in permanent system files at the bank.  The bank will need a number of applications e.g.

i. Program to debit or credit an account ii. A program to add a new account iii. A program to find the balance of an account iv. A program to generate monthly statements v. Any new program would be added as per the banks requirements

 Such a typical filing /processing system has the limitation of more and more files and application programs being added to the system at any time. Such a scheme has a number of major disadvantages:

i. Data redundancy and inconsistency - Since the files and application programs are created by different programmers over a long period of type, the files are likely to have different formats and the programs may be written in several programming languages. Moreover, the same piece of information may be duplicated in several files. This redundancy leads to higher storage and access costs. It may also lead to inconsistency i.e. the various copies of the same data may no longer agree.

ii. Difficulty in accessing - Suppose that one of the bank officers needs to find out the names of all customers who live within the city's 78-phone code. The officer would ask the data processing department to generate such a list. Such a request may not have been anticipated while designing the system originally and the only options available are:-

 Extract the data manually  Write the necessary application, therefore do not allow the data to be accessed conveniently and efficiently

iii. Data isolation - Since data is scattered in various files and files may be in different formats, it may be difficult to write new applications programs to retrieve the appropriate data. iv. Concurrent access anomalies - Interaction of concurrent updates may result in inconsistent data e.g. if 2 customers withdraw funds say 50/= and 100/= from an account at about the same time the result of the concurrent execution may leave the account in an incorrect state. v. Security problems - Not every user of the database system should be able to access all the data. Since application programs are added to the system in an ad-hoc manner, it is difficult to enforce security constraints. vi. Integrity - The data value stored in the database must satisfy certain types of consistency constraints e.g. a balance of a bank account may never fall below a prescribed value e.g. 5,000/=. These constraints are enforced in a system by adding appropriate code in the various application programs. However, when new constraints are added there is need to change the other programs to enforce.

Conclusion. These difficulties among others have prompted the development of DBMS.

1.2 Evaluation of the DBMS

Unlike the file system with may separate and unrelated files, the Database consists of logically related data store in a single data repository. The problems inherent in file systems make using the database system very desirable and therefore, the database represents a change in the way the end user data are stored accessed and arranged.

1.3 Types Of Database Systems

i. Single User database systems

This is a database system that supports one user at a time such that if user A is using the database, users B & C must wait until user A complete his or her database work. If a single user database runs on a personal computer it’s called a desktop database.

process that the DBMS and additional checks before permitting access to sensitive data. Different levels of security can be implemented for various types of data or operations.

  1. Conflict Resolution - The DBA is in a position to resolve conflicting resolve conflicting requirements of various users and applications. It is by choosing the best file structure and access method to get optimum performance for the response. This could be by classifying applications into critical and less critical applications.
  2. Data Independence - It involves both logical and physical independence logical data independence indicates that the conceptual schemes can be changed without affecting the existing external schemes. Physical data independence indicates that the physical storage structures/devices used for storing the data would be changed without necessitating a change in the conceptual view or any of the external use.

1.5 Disadvantages Of Database Systems

  1. Cost - in terms of:

 The DBMS - software  Purchasing or developing S/W  H/W  Workspace (disks for storage)  Migration (movement from tradition separate systems to an integrated one)

  1. Centralization Problems

You would require adequate backup incase of failure You would require increased severity of security breeches and disruption of operation of the organisation because of downtimes and failures.

  1. Complexity of Backup and recovery

File System Environment

________________________________________________________________________

______

Integrated

System

Database System Environment

The database eliminates most of the file systems' data inconsistencies, anomalies and structural dependency problems.

The current generation of DBMS software stores not only the data structures in a central location but also stores the relationships between the database components The DBMS also takes care of defining all the required access paths of the required component.

1.6 The Database System Environment

The term database system refers to an organisation of components that define and regulate the collection storage, management and use of data within a database environment. The database system is composed of 5 major parts i.e.

Personnel Department

Accounts Department

Sales Department

employees customer sales inventory accountsaccounts

Personnel Department

Sales Department

Accounting Department

DBMS

DATABASE

Employees Customers Sales Inventory Accounts

Hardware This identifies all the systems physical devices e.g. the composition peripherals, storage devices etc.

Software These are a collection of programs used by the computers within the database system. i. O.S - manages all hardware components and makes it possible for all other and software to run on the composition. ii. The DBMS - manages the database within the database system e.g. Oracle, DB2, Ms Access etc. iii. Applications programs and utilities to access and manipulate data in the DBMS.

People These are all database systems users:-

  1. Systems administrator - Oversees the database systems general operations.
  2. Database administrator (DBA) - Manages the DBMS use and ensures that the database is functioning properly. His functions include:

i. Scheme definition - The original database scheme is created by writing a set of definitions, which are translated by DDL compiler to a set of tables that are permanently stored in the data dictionary. ii. Storage structure and Access Methods Definitions - By writing a set of definitions for appropriate storage structures and access methods, which are translated by the data storage and definition language compiler. iii. Scheme and physical organisation modifications - Modification to either the database schema or description of the physical storage organisation are accompanied by writing a set of definitions which are used by either the DDL compiler or the data storage and definition language compiler to generate modification to appropriate internal systems tables e.g. data dictionary. iv. Granting authorization to data access - This is so as to regulate which parts of the database users can access. v. The database manager keeps integrity Constrains in a special system structure whenever an update takes place in the system.

  1. Database designers - These are the database architects who design the database structure.
  2. Systems Analysts & Programmers (application programmers) - They design and implement the application programs they design & create the data entry scheme, reports & procedures through which users access and manipulate the databases data.

2.0 DATABASE ARCHITECTURE AND ENVIRONMENT

2.1 Abstraction and Data Integration

Abstraction is the simplification mechanism to hide superfluous details of a set of objects. It allows one to concentrate on the properties that are of interest to the application e.g. a car is an abstraction of personal transportation vehicle but does not reveal details about model, year, colour etc. Vehicle itself is an abstraction that includes the types; car, truck, bus and lorry.

Consider a non- database environment of a number of application programs as shown below:

Application 1 will contain values for the attributes employee Name and Employee. Address and this record can be described in pseudo-code as

Type Employee = record Employee.name:string Employee.address:string End

Application 2 will have:

Type Employee = record Employee.name: String Employee.soc_sec_No: Integer Employee.Adress: String Employee. Annual_salary:integer End

In a non-database environment each application is responsible for maintaining the currency of data and a change in data item.

In a database environment, data can be stored in this application and their requirement be integrated by whoever is responsible for centralized control (DBA). The integrated version would appear as recorded containing attributes required by both applications.

The record will appear as: Type Employee = record Employee.Name:string Employee.soc-sec.no: Integer Employee.Address:string Employee.Annual_Salary: double End

The views supported are derived from the conceptual record by using appropriate mapping.

The application programs no longer require information about the storage structure; storage device types or access methods. These are absorbed by the DBMS.

There are 3 level abstractions corresponding to 3 views: i. The highest level which is seen by the application programs or user called “external or user view" ii. A sum total of users view called global view a conceptual view. iii. Lower level which is the description of the actual method of storing the data. It is also referred to as the internal view.

Local View Employee.Name Employee.Name Employee.Address Employee.Soc_Sec_No Employee.Address Employee.Annual_Sal

Conceptual View Employee.Name:String Employee.Soc_Sec_No:Integer DBA Employee.Address:String Employee.Annual_Sal:Double

Connection to the DBA

Internal View Name:String Length 25 Offset 0 Soc_Sec_No:Integer 9 Offset 25 Address: String Length 5 Offset 34 Salary: 9,2 dec Offset 39

The 3 level scheme architecture is called the ANSI/SPARC model (American National Standard Institute/Standards Planning and Requirements Committee.) It is divided into 3 levels:  External  Conceptual  Internal

The view of each level is described as a scheme, which is an outline or a plan that describes the records and relations existing in the view. It also describes the way in which entities at one level of abstraction can be mapped onto the next level. External Level (External or User view)

User 1 User 2

Mapping between views Two mappings are required, one between external and conceptual views and another between the conceptual records to internal ones.

Data Independence

This is the immunity of users/application programs from changes in storage structure and access mechanism. The 3 levels of abstractions along with the mappings from internal to conceptual and from conceptual to external provide 2 distinct levels of data independence i.e.:  Logical Data Independence  Physical Data Independence

(i) Logical Data Independence

This indicates that the conceptual schema can be changed without affecting the existing external schema. The mapping between the external and conceptual levels would absorb the change.

It also insulates application programs from operations such as combining two records into one or splitting an existing record into 2 or more records. The LDI is achieved by providing the external level or user view database.

The application programs or users see the database as described by the respective external view. DBMS provided a mapping from this view to the conceptual view. NB: The view at conceptual level of the database is the sum total of the current and anticipated views of the database.

(ii) Physical Data Independence

This indicates that the physical storage structures or devices used for storing the data can be changed without necessitating a change in the conceptual view or any of the external view. Any change is absorbed by the mapping between the conceptual and internal views.

2.3 Components Of The DBMS

A DBMS is software used to build, maintain and control database systems. It allows a systematic approach to the storage and retrieval of data in a computer. Most DBMS(s) have several major components, which include the following:

  1. Data Definition Language (DDL ) - These are commands used for creating and altering the structure of the database. The structures comprise of Field Names, Field sizes, Type of data for each field, File organizational technique. The DDL commands are used to create new objects, alter the structure of existing ones or completely remove objects from the system.
  2. Data Manipulation language (DML ) - This is the user language interface and is used for executing and modifying the contents of the database. These commands allow access and manipulation of data for output. They include commands for adding, inserting, deleting, sorting, displaying, painting etc. These are the most frequently used commands once the database has been created.
  3. Data Control Language (DCL) - These are commands used to control access to the database in response to DML commands. It acts as an interface between the DML and the OS. It provides security and control to the data.
  4. Query Languages - A query language is a formalized method of constructing queries in database system. It provides the ways in which the user interrogates the database for data without using conventional programs. For relation database, structures query languages (SQL) has emerged as the standard language. Almost all the DBMS(s) use SQL running on machines ranging from microcomputers to large main frames.
  5. Form Generator - A form is a screen display version of a paper form, which can be used for both input and output.
  6. Menu Generator - This is used to generate different types of menus to suit user requirements.
  7. Report Generator - This is a tool that gives non- specialized users the capability of providing reports from one or more files through easily constructed statements. The reports may be produced either constructed statements. The reports may be produced either on screen or paper. A report generator has the following features:  Page headings and footings  Page Numbering  Sorting  Combining data from several files  Column headings  Totaling and subtotaling  Grouping of data  Reports titling

the DBMS transform the physically retrieved data to conform to the users logical expectations. This is by providing application programs with software independence and data abstraction.

iv. Security Management - The DBMS creates the systems security that enforces users security and data privacy within the database. Security rules determine which users can access database which data item each user can access and which data operations (read, add, delete, modify) the user may perform. This is important in multi user database system where many users can access the database simultaneously.

v. Multi User Access Control - The database creates complex structures that allow multi- user access to the structure. In order to provide data integrity and consistency the DBMS users sophisticated algorithms to ensure that multiple users can access the database con-currently and still guarantee integrity of the database.

vi. Back-up and recovery management - To ensure data safety and integrity current DBMS systems provide special utilities that allow the DBA to perform routing and special backup and restore procedures. Recovery management deals with recovery of the database after a failure such as a bad sector in the disk, a power failure etc. Such capability is critical to the preservation of the database integrity.

vii. Data integrity Management - The DBMS promotes and enforces integrity rules to eliminate data integrity problems thus minimizing data redundancy and maximizing data consistency. The relationships stored in the Data Dictionary are used to enforce data integrity. Data integrity is especially important in transaction oriented database systems.

viii. Data base Access Language and Application Programming Interfaces - The DBMS provides data access via a query language. It contains 2 components, DDL and DML. The DDL defines the structures in which the data are housed and the DML allows end users to extract the data from the database. It also allows data access to programmers via procedural languages such as Cobol, C, Pascal, and Visual Basic etc. It also provides utilities used by the DBA and the Database Designer to create, implement, monitor and maintain the database.

ix. Database Communication interfaces - Current generation of DBMS's provide special communication routines designed to allow the database to accept end-use r requests within a computer network environment. The DBMS may provide communication functions to access the database through the internet using internet browsers e.g. Netscape or Explorer as the front-ends

2.5 Overall System Structure

A database system is partitioned into modules that deal with each of the responsibilities of the overall systems. The design of the database system must include consideration of the interface between the database system and the O.S. The functional components of a database system include:  File Manager  Data base manager  Query processor  DML pre-compiler  DDL compiler

File Manager This manages the allocation of space in the disk storage and the data structures used to represent information stored on the disk. It deals more on the physical aspects.

Database Manager Provides the interface between the low level data stored in the database and the application and programs the queries submitted to the system.

Query Processor This translates statements in a query language into low-level instruction that the DB manager understands. In addition the query processor attempts to transform a user request into more efficient statement, thus finding a good strategy for executing the query.

DML Pre-compiler This converts the DML statements embedded in an application program to normal procedure calls in the language. The pre-compiler must interact with the query processor order generate the appropriate code.

DDL Compiler - This converts DDL statements to a set of table containing metadata.

 This involves the conceptual design, selection of database, management system software.  Creation of the logical design  Creation of the physical design

  1. Implementation

 This involves installation of the DBMS  Creation of the database  Loading or conversion of data

  1. Testing and evaluation The activities involve:

 Testing the database  Tune the database  Evaluate the database application programs  Provide the required information flow

  1. Operation

Once the database has passed the evaluation stage it is considered to be operational, the database, its management, its users and its application programs constitute a complete I.S. The beginning of the operational phase starts the process of system evaluation.

  1. Maintenance and Evaluation

It involves the following:  Preventive Maintenance  Corrective maintenance  Adaptive maintenance  Assignment and maintenance of access permission to new and old user  Generation of database access statistics to improve the efficiency and usefulness of audits and to monitor system persons.  Periodic security based on the system generated statistics  Periodic (monthly, quarterly or yearly) system using summaries for internal billing or budgeting purposes.

3.0 CONCEPTUAL DATA MODEL

A database model is a collection of logical constructs used to represent the data structure and relationships found within the database.

3.1 Types Of Data Models

  1. Object Based Logical Models They are used in describing data at the conceptual and view levels. They provide fairly flexible structuring capabilities and allow data constraints to be specified explicitly. They include:  E - R Model  Object Oriented Model  Binary Model  Semantic Data Models  Info-logical Data Model  Function
  2. Record Based Logical Models

These are models used in describing data at the conceptual and view levels. They are used to specify the overall logical structure of the database and to provide a higher-level description implementation. It is hard to understand.

  1. Physical Data Models

These are models that are used to describe data at the lowest level. They are very few in number and the two widely known ones are: i. Unifying model ii. Frame memory model

NB: Like the E-R model, the object-oriented model is based on a collection of object where an object contains values stored in instance variables with the object.

3.2 The E- R Model (Entity Relationship)

It is based on a perception over a real world, which consists of a collection of basic objects called entities and relationships among this objects. An entity is an object that is distinguished from other objects via a specific set of attributes.

3.2.1 E-R Model Basic Concepts

The model employs the following components:  Entity sets  Relationship sets  Attributes