Professional Documents
Culture Documents
Overview
• History of Database
• What is a Database?
• Components of a Database
• Different Database Users
• Data Abstraction
• Database Schema and Instances
• Database Languages – DDL, DML, DQL, DCL
• Data Models
• Transaction Management
• Database Management System
• Data Administrator (DA) & Database Administrator (DBA)
• Advantages and Disadvantages of a DBMS
History of Database
Data may be defined as a collection of
related information. For example during a No. CJ2ed/0221 A. Banerjee
census, information related to different people Cobol Made Easy 2/3 Park Circus
– like name, age, occupation, income etc. may J. K. Jones Calcutta 700019
be collectively stored for each person, thus Second Edition 1. MK1ed/2341
$10.95 2. CG1ed/0542
forming a list of related data. To make use of
this huge amount of data, it needs to be stored
to be accessed efficiently whenever needed. Book Index Cards Member Index Cards
Before the advent of computers, paper index cards were used to store information
and maintain a catalogue of different types of related data. For example a library
would use different sets of index cards – one set to keep a record of its books and
another set to keep a record of its members. When a new book was bought, a
separate index card was added to the existing list with information related to the
new book. Similarly when a new member joined the library, a new card was added
to the member set with information related to the member and the books borrowed.
With the emergence of computers, instead of using paper index cards, data were
stored in separate computer files in the form of records. Each file contained a group
of related records. Thus the library would now have a file containing records of the
different books and a separate file to contain records of the different members.
The figure to the right shows one such application Supplier
where a manufacturing company is using three Processing Supplier
separate files for its business. Application Data File
The first file, the Supplier file, stores a list of Supplier File User
names, addresses, telephone numbers, and
contact persons of different suppliers who are
supplying raw materials to the company for Order
Processing Order
making their products. Data File
Application
The second file, the Order file, is storing details of
the purchase orders placed on the different Order File User
suppliers for raw materials.
Payment
The third file, the Payment file, is storing details Payment
Processing
of the payments made to the different suppliers Application Data File
against their purchase orders based on their terms
of payment. Payment File User
The users of the different files interact with the
files by means of specific application programs.
Thus the Supplier file user interacts with the
Supplier file through the Supplier Processing
Application program, the Order file user uses the
Database Users
The main aim of a database is to provide ways of storing and retrieving information
in an efficient manner. To do this, different kinds of people may need to access or
handle the database both during the development and during the implementation
stage. These users include the general public accessing a public database like a
railway reservation database. They may include company executives handling
confidential data in the company database. At the lower end we have the computer
professionals engaged in developing a database and the data-entry operators
engaged in entering the raw data into the database. Depending upon the type of
use, we can classify database users into the following categories:
1. Application Programmers: These are people who are engaged in developing
general application programs to access databases. The application program
is usually written in a base or host language (like C, Visual Basic etc.).
Data Abstraction
In a database, the stored data needs to be
retrieved and manipulated efficiently. View Level
Complex algorithms and data structures have View 1 View 2 … View n
been developed to do this. However not all
users of the database are computer experts and
hence may not be expected to understand these Logical Level
complex data structures to manipulate the data.
To overcome this difficulty, the database Physical
Level
approach provides some level of data
abstraction i.e. the developers of the database
hide from the database users the details of
actually how the data is stored. Instead, it
presents to the user a view of the data that is
readily understandable by him. This helps to
simplify the users’ interaction with the database
system as it allows the user to manipulate the
data without being concerned about the underlying mechanism by which the data
gets actually stored.
In a database system thus different levels of data abstraction are used to simplify
the final data representation i.e. to connect the raw data type to the final user view
of the data. These levels include:
1. Physical Level: This is the lowest level of data abstraction. At this level the
complex low level data structures used to store the data are described. For
example at the byte level, the different records that comprise a database may
be stored as a linear linked list, as a binary tree structure, as fixed length records
or as variable length records. The data representation at the physical level thus
describes how blocks of data consisting of bytes of raw data are stored
in consecutive storage locations. The database system hides many of these
lowest level storage details from the database programmers and the end users.
2. Logical Level: This is the next higher level. At this level the data and the
relationships that exist between those data are defined. The entire database
Suppli
Supplier es Items
Transaction Management
When working with a database, there may arise certain situations, when a particular
transaction involves two or more separate operations which form one logical unit
of work. For example consider the situation in a stock transfer. Suppose ‘x’ units of
item-t are transferred from the store in a factory to the showroom for sale. For a
valid transfer, the stock of item-t in the factory should get reduced by ‘x’ units
and simultaneously the stock of item-t in the showroom should get increased by ‘x’
units to keep the total number of units constant before and after the transfer. The
transaction will be incomplete and erroneous if either the factory stock or the
showroom stock is not updated due to some errors during the transfer. Thus either
both the transactions should occur or neither should occur. This all-or-none
requirement is called atomicity. A similar situation arises in case of money
transfer form one bank account to another. There the debit from one account must
be followed by a credit from another account simultaneously.
Atomicity
Moreover in case of money transfer, the total amount involved in the transaction
should be constant. Therefore an increase in the account A should correspond to a
decrease in the account B, i.e. the sum of the money in account A and that in
account B should be preserved. This requirement to maintain the correctness of
the transfer is called consistency. After a particular transfer is over, the database
should be able to preserve the new values in spite of any system snag or failure.
This property is called durability.
Consistency
We call this collection of separate operations that form a single logical unit of
work, a transaction. Each transaction forms one unit of both atomicity and
consistency. In our above example, the change of records in the two accounts was
carried out by two separate operations or programs. Here each program by itself
does not transfer the database from one consistent state to another. Hence each Transaction
program by itself does not carry out a transaction as the atomicity property is not
satisfied in such an operation. Thus in case all the operations in a transaction do not
take place due to a system failure or any other mishap, a failed transaction should
have no effect on the state of the database and the database must be restored to
the previous state before the said transaction had started.
It is the responsibility of the Transaction Management Module of a DBMS to
preserve the state of the database in case of any failures. Moreover it is the
responsibility of the database programmer to design the database in such a manner
so as to maintain these two properties in a transaction.