You are on page 1of 18

CHAPTER - 1

INTRODUCTION TO DBMS

1.1 INTRODUCTION
Data

Data is a collection of facts and figures that can be processed to produce information.
In otherwords, Data can be any character, text, word, number, and, if not put into context,
means little or nothing to a human.

Example: boy, 2nd, arun,07

Information

Information is a collection of data, which give a convenient meaning. In otherwords,


data formatted in a manner that allows it to be utilized by human beings in some significant
way.
Example: Arun is 2nd rank in his class.

Database

Database is a collection of inter-related data which is used to retrieve, insert and delete
the data efficiently. For example, consider employee database consists of following
columns-eno, ename and salary.

Fig. 1.1 Example of Database


DBMS
A Database Management System (DBMS) is software that facilitates the creation,
storage, retrieval and manipulation of data in the database.

DBMS also provides protection and security to the databases. It also maintains data
consistency in case of multiple users. Some examples of popular DBMS namely,
Intoduction to Database 1.2

 MySQL
 Oracle
 SQL Server
 IBM DB2
 PostgreSQL
 Amazon Simple DB (cloud based)

Goals of DBMS
The goal of the DBMS is to provide a convenient and effective method of defining,
storing and retrieving the information contained in a database.
.
1.2 PURPOSE OF DATABASE SYSTEMS
To understand the purpose of database system, let us consider part a savings-bank
enterprise that keeps information about all customers and savings accounts. One way to keeps
information on a computer is to store it in operating system files. To allow users to manipulate
the information, the system has a number of application programs that manipulate the files,
including
 A program to debit or credit an account
 A program to add a new account
 A program to find the balance of an account
 A program to generate monthly statements
System programmers wrote these application programs to meet the needs of the bank.
New application programs are added to the system as the need arises. For example,
suppose that the savings bank decides to offer checking accounts. As a result, the bank creates
new permanent files that contain information about all the checking accounts maintained in
the bank, and it may have to write new application programs to deals with situations that do
not arise in savings accounts, such as overdrafts. Thus, as time goes by, the system acquires
more files and more application programs.
This typical file-processing system is supported by a conventional operating system. The
system stores permanent records in various files, and it needs different application programs
to extract records from, and add records to, the appropriate files. Before database management
systems (DBMS) came along, organizations usually stored information in such systems.
1.3 Database Management Systems

Disadvantages of File Systems Over Database Systems

1. Data Redundancy: Data Repetition is possible that the same information may be duplicated
in different files, this leads to data redundancy results in memory wastage.

Example: A student is having record in college library and in Examination department. Then
his name, roll number, fathers name and class will be same in both the departments. Also
these departments are not dependent on each other. So it creates lots of duplicates value about
that student and when he needs any change for his name or class then he has to go to both the
departments to make these changes happen otherwise it will create problem for him.

2. Data Inconsistency: Because of data redundancy, it is possible that data may not be in
consistent state.

Example: If you change student name in library then his name should be changed in all the
departments related to the student.

3. Difficulty in Accessing Data: Accessing data is not convenient and efficient in file
processing system.
Example: one of the bank officers needs to find out the names of all customers who live
within a particular postal- code area. If there is no application program for this means, the
officer has 2 alternatives: 1. Preparing the list manually from the list of all customers. 2. Ask
system programmer to write the necessary application programs.

4. Limited Data Sharing: Data are scattered in various files, also different files may have
different formats and these files may be stored in different folders may be of different
departments. So, due to this data isolation, it is difficult to share data among different
applications.

Example:

5. Integrity Problems: Data integrity means that the data contained in the database in both
correct and consistent, for this purpose the data stored in database must satisfy correct and
constraints.

Example: The maximum marks of the student can never be more than 100.

6. Atomicity Problems: Any operation on database must be atomic, (i.e.) it must happen in
its entirely or not at all.

Example: If you are buying a ticket from railway and you are in the process of money
transaction. Suddenly, your internet got disconnected then you may or may not have paid for
Intoduction to Database 1.2

the ticket. If you have paid, then your ticket will be booked and if not then you will not be
charged anything. That is called consistent state, means you have paid or not.

7. Concurrent Access Anomalies: Multiple users are allowed to access data simultaneously,
this is for the sake of better performance and faster response.

Example: Consider an operation to debit (withdrawal) an account. The program reads the old
balance, calculates the new balance, and writes new balance back to database. Suppose an
account has a balance of Rs. 5000. Now, a concurrent withdrawal of Rs. 1000 and Rs. 2000
may leave the balance Rs. 4000 or Rs. 3000 depending upon their completion time rather than
the correct value of Rs. 2000.

8. Security Problems: Database should be accessible to users in limited way. Each user should
be allowed to access data concerning his requirements only.

Example: If a student can access his data in the college library then he can easily change
books issued date. Also he can change his fine detains to zero.

To overcome these difficulties, the database management system (DBMS) was developed.

Table 1.1 Difference between DBMS and File System


DBMS File System
Collection of data and set of programs to Abstraction to store, retrieve and update a
access those data. set of files.
Repetition of data can be reduced. Repetition of data cannot be reduced.
Inconsistency of data can be avoided. Inconsistency of data cannot be avoided.
Data can be shared easily. Data cannot be shared easily.
The data can be accessed from the database Data independence cannot be provided to
through physically as well as logically. access the data.
It gives fast response to information request It gives slow response to information
because the data are integrated into a single request.
database.
It restricts unauthorized access. Lack of security.
Data can be accessed by multiple users at Problem in concurrency control.
same point of time.
It provides back up of data and restores the It does not provide back up and data
database to its original state after database recovery. The data may loss if the
1.3 Database Management Systems

failure. operation is failed.

1.3 VIEWS OF DATA


Data Abstraction
Database systems are made-up of complex data structures. To ease the user interaction
with database, the developers hide internal irrelevant details from users. This process of hiding
irrelevant details from user is called data abstraction.

Fig. 1.2 Views of Data


Physical level (Internal Level):
 This is the lowest level of data abstraction.
 The internal level has an internal schema which describes the physical storage
structure of the database.
 The internal schema is also known as a physical schema.
 It uses the physical data model. It is used to define that how the data will be stored in
a block.
 The physical level is used to describe complex low-level data structures in detail.

Logical level (Conceptual Level):


 This is the middle level of data abstraction.
 The conceptual level has a conceptual schema which describes the design of a
database.
 The conceptual schema describes the structure of the whole database.
 The conceptual level describes what data are to be stored in the database and also
describes what relationship exists among those data.
Intoduction to Database 1.2

 Programmers and database administrators work at this level.

View level (External Level):


 This is the last level of data abstraction.
 At the external level, a database contains several schemas that sometimes called as
subschema. The subschema is used to describe the different view of the database.
 An external schema is also known as view schema.
 The view schema describes the end user interaction with database systems.

1.4 SCHEMAS AND INSTANCES


Schema: Design of a database is called the schema. Schema is of three types: Physical
schema, logical schema and view schema.

Instance: The data stored in database at a particular moment of time is called instance
of database. Database schema defines the variable declarations in tables that belong to a
particular database; the value of these variables at a moment of time is called the instance of
that database.

1.5 DATA MODELS


1.5.1 Introduction

Data Model is a collection of conceptual tools for describing data, data relationships,
data semantics and consistency constraints.

Data Models can be classified into three categories


1. Object-based logical model
2. Record-based logical model

1.5.2 Object-Based Logical Models

It is a collection of conceptual tools for describing data, data relationships and data
constraints. There are various object-based models like,
 Entity-Relationship Model
 Object Oriented Model

Advantages
1. Exceptional conceptual simplicity
2. Visual representation
3. Effective communication tool
4. Integrated with the relational database model.
Disadvantages
1.3 Database Management Systems

1. Limited constraint representation


2. Limited relationship representation
3. No data manipulation language
4. Loss of information content

1.5.3 Record Based Logical Models

The record based model describes the data structures and access techniques of a
DBMS. There are three types of record-based models viz.

 Hierarchical Model
 Network Model
 Relational Model

1.5.3.1 Hierarchical Data Model

In Hierarchical data model,


 Organizes the data in a Tree Structure
 Hierarchy of parents and child segments
 Data is represented by a collection of record types
Hierarchical model for example is shown in Fig. 1.4.

Fig. 1.3 Hierarchical data model

Advantages
1. Conceptual Simplicity
2. Database Security
3. Data Independence
4. Database Integrity
5. Efficiency.
Disadvantages
Intoduction to Database 1.2

1. Complex Implementation
2. Difficult to manage
3. Lack of structural independence
4. Implementation limitations
5. Lack of standards

1.5.3.2 Network Data Model

In Network data model,


 Organizes the data in a Graph Structure
 Relationships among data are represented by links
 Data is represented by a collection of record types
Network model for example is depicted in Fig. 1.5.

Fig. 1.4 Network data model


Advantages
1. Conceptual Simplicity
2. Handles more relationship types
3. Data access flexibility
4. Promotes database integrity
5. Data independence
6. Conformance to standards

Disadvantages
1. System complexity
1.3 Database Management Systems

2. Lack of structural independence


1.5.3.3 Relational Data Model
In relational data model,
 Data is viewed as existing in two dimensional tables known as relations.
 A relation (table) consists of unique attributes (columns) and tuples(rows)
 Sometimes the value to be inserted into a particular cell may be unknown, or it
may have no value. This is represented by a NULL.
 NULL is not the same as zero, blank or an empty string.
 Relational Database: Any database who logical organization is based on
relational data model.
 RDBMS: A DBMS that manages the relational database.

Table 1.2 Relational data model for example

Customer Sale

Cust no Name Cust Cust Cust no Item Qty


Category Country
D C1 I1
D D 300
C1 Alicia D A D UK C2 I1 300
C2 Malcom A USA C3 I2 200
C3 Francis C UK C2 I2 400
C1 I2 200
C1
Item 200 200 C1 I3 400
C1 400 400
Item no Name 200
Colour 200
Price
400 400
D I1 Clips
D Silver
D D 25
I2 Clock Red 700
I3 Bag Blue 500
I4 Lamp Gold 1000
C1 12
Fig. 1.4

Advantages
1. Structural independence
Intoduction to Database 1.2

2. Improved conceptual simplicity


3. Easier database design, implementation, management, and use
4. Adhoc query capability
5. A powerful database management system.
Disadvantages
1. Substantial hardware and system software overhead
2. Poor design and implementation
3. May promote “islands of information” problems.

1.6 DATABASE SYSTEM ARCHITECTURE OR COMPONENTS OF


DBMS
1.6.1 Components of DBMS

The functional components of a database system can be divided into 3 units:

a) Storage Manager
b) Query Processor
c) Database Users and Administrators

a) Storage Manager: It is important because database typically requires a large amount of


storage space. It is a program module that provides an interface between the low level data
stored in the database and the application programs and queries submitted to the system.
The storage manager translates the various DML statements into low level file system
commands. Thus the storage manager is responsible for storing, retrieving and updating the
data in the database.
It includes the following components.

(1) Authorization and Integrity Manager: which tests for the satisfaction of
integrity constraints and checks the authority of users to access data.
(2) Transaction Manager: which ensures that the database remains in a consistent
state when the system failures and that concurrent transaction executions
proceed without conflicting.
(3) File Manager: which manages the allocation of storage space on disk and data
structures used to store that information’s.

(4) Buffer Manager: which is responsible for fetching data from disk into main
memory.
1.3 Database Management Systems

Fig. 1.5 System structure


Data Structure used by the Storage Manager

 Data files, which stores database itself.

 Data dictionary, which stores meta data about the structure of the database,
in particular schema of the database.

 Indices, which can provide fast access to data items. Hashing technique is
used for accessing.
Intoduction to Database 1.2

b) Query Processor
It contains the following components.
 DDL Interpreter: which interprets DDL statements (i.e., converts DDL
statement into low level data).
 DML Compiler: Which translates DML statements into an low level
instructions that the query evaluation engine understands. Also performs Query
optimization.
 Query Evaluation Engine: Which executes low level instructions generated by
the DML compiler.
c) Database Users
 Application programmers: Computer professionals who interact with the
system through DML calls, which are embedded in a program written in a host
language (Cobol, PL/I, Pascal, C).
 Sophisticated users: Interact with the system through the database query
language.
 Specialized users: Specialized users who write specialized database
applications that do the into the traditional data processing frame work (e.g: CAD
system, knowledge based and expert systems.)
 Naive Users: Interact with the system by invoking one of the permanent
applications.
 Database Administrator: A person who has such central control over the
system is called a database administrator (DBA).
The functions of a DBA include:
1. Schema definition: The DBA creates the original database schema by
executing a set of data definition statements in the DDL.
2. Storage structure and access-method definition.
3. Schema and physical-organization modification: The DBA carries out
changes to the schema and physical organization to reflect the changing
needs of the organization to improve performance.
4. Granting of authorization for data access: By granting different types of
authorization, the database administrator can regulate which parts of the
database various users can access. The authorization information is kept in
a special system structure that the database system consults whenever
someone attempts to access the data in the system.
1.3 Database Management Systems

5. Routine maintenance: Examples of the database administrator’s routine


maintenance activities are:
 Periodically backing up the database
 Ensuring that enough free disk space is available for normal
operation
 Monitoring jobs running on the database
1.6.2 Advantages of DBMS
1. Control of data redundancy
2. Data consistency
3. Improved data integrity
4. Improved security
5. Balance of conflicting requirements
6. Improved data accessibility and responsiveness
7. Increased productivity
8. Increased maintenance through data independence
9. Increased concurrency
10. Improved backup and recovery services

1.6.3 Disadvantages of DBMS


1. Complexity
2. Size
3. Cost of DBMS
4. Additional hardware costs
5. Cost of conversion
6. Performance
7. Higher impact of failure
Intoduction to Database 1.2

IMPORTANT QUESTIONS & ANSWERS


PART – A

1. Define database management system?


Database management system (DBMS) is a collection of interrelated data and a set of
programs to access those data.

2. What are the responsibilities of a DBA?


The role includes the development and design of database strategies, monitoring and
improving database performance and capacity, and planning for future expansion
requirements. They may also plan, co-ordinate and implement security measures to
safeguard the database

3. What is data base management system?


 A database management system (DBMS) is a software package with computer
programs that control the creation, maintenance, and the use of a database.
 DBMSs may use a variety of database models, such as the relational model or
object model, to conveniently describe and support applications.
 A DBMS provides facilities for controlling data access, enforcing data integrity,
managing concurrency control, recovering the database after failures and restoring
it from backup files, as well as maintaining database security.

4. List any eight applications of DBMS.


a) Banking
b) Airlines
c) Universities
d) Credit card transactions
e) Tele communication
f) Finance
g) Sales
h) Manufacturing
i) Human resources
5. What are the disadvantages of file processing system?
The disadvantages of file processing systems are
a) Data redundancy and inconsistency
1.3 Database Management Systems

b) Difficulty in accessing data


c) Data isolation
d) Integrity problems
e) Atomicity problems
f) Concurrent access anomalies
6. What are the advantages of using a DBMS?
The advantages of using a DBMS are
a) Controlling redundancy
b) Restricting unauthorized access
c) Providing multiple user interfaces
d) Enforcing integrity constraints.
e) Providing backup and recovery

7. Compare file systems versus DBMS?


The main differences between a file processing system and a DBMS are:
DBMS File System
Collection of data and set of programs to Abstraction to store, retrieve and update a
access those data. set of files.
Repetition of data can be reduced. Repetition of data cannot be reduced.
Inconsistency of data can be avoided. Inconsistency of data cannot be avoided.
Data can be shared easily. Data cannot be shared easily.
The data can be accessed from the database Data independence cannot be provided to
through physically as well as logically. access the data.
It gives fast response to information request It gives slow response to information
because the data are integrated into a single request.
database.
It restricts unauthorized access. Lack of security.
Data can be accessed by multiple users at Problem in concurrency control.
same point of time.
It provides back up of data and restores the It does not provide back up and data
database to its original state after database recovery. The data may loss if the
failure. operation is failed.
8. Give the levels of data abstraction?
a) Physical level-Describes how the data are actually stored.
b) Logical level-Describes what data are stored and what relationships exist among
Intoduction to Database 1.2

those data.
c) View level – Describes the part of entire database

9. What is data model?


Data model is a collection of conceptual tools for describing data, data relationships, data
semantics and consistency constraints.

10. What are the types of data models?


a) Entity relationship model
b) Relational model
c) Hierarchical model
d) Network model
e) Object based data model(Object Oriented & Object relational)

11. What is an entity relationship model?


The entity relationship model is a collection of basic objects called entities
and relationship among those objects. An entity is a thing or object in the real
world that is distinguishable from other objects.

12. What is storage manager?


A storage manager is a program module that provides the interface between the
low level data stored in a database and the application programs and queries submitted to
the system.

13. What are the components of storage manager?


The storage manager components include
a) Authorization and integrity manager
b) Transaction manager
c) File manager
d) Buffer manager

14. What is the purpose of storage manager?


The storage manager is responsible for the following
a) Interaction with the file manager
b) Translation of DML commands in to low level file system
c) Storing, retrieving and updating data in the database

15. List the data structures implemented by the storage manager .


The storage manager implements the following data structure
1.3 Database Management Systems

a) Data files
b) Data dictionary
c) Indices

16. What are the components of query processor?


a) DDL interpreter
b) DML compiler
c) Query evaluation

17. Mention the database users?


Database users are differentiated by the way they expect to interact with the
system
 Application programmers – interact with system through DML calls
 Sophisticated users – form requests in a database query language
 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. For example, people accessing database over the web, bank tellers,
clerical staff etc.

18. What are the functions of Database administrator?


a) Schema definition
b) Storage structure and access method definition
c) Schema and physical organization modification
d) Granting user authority to access the database
e) Specifying integrity constraints
f) Monitoring performance and responding to changes in requirements

19. What is a data dictionary?


A data dictionary is a data structure which stores meta data about the structure of the
database i.e. the schema of the database.

PART – B

1. Explain the drawbacks of traditional file processing systems with examples


2. With the help of a block diagram explain the basic architecture of a database
management system.
3. What are the different data models present and explain briefly?
Intoduction to Database 1.2

4. How does DBMS provide data abstraction? Explain the concept of data
independence.
5. With a neat diagram describe the overall system structure of DBMS.

6. Draw and explain three-tier schema architecture of database system.

You might also like