Professional Documents
Culture Documents
Introduction
A DBMS provides a secure and survivable medium for the storage and retrieval of
data. In the real world, the data is shared among several users and is persistent. Also
the real world data have a structure, related to one another and have constraints.
These features are well represented and can be efficiently managed using a DBMS.
Also the different users of the data need to create, access and manipulate the data.
The DBMS provides mechanism to achieve these objectives without cornpromising
security and integrity of data.
(1 - 1)
I
lntroduction Databi
Database Management SYstems 1-2
users want it to be secure If
Therefore, if the data is shared, if it is persistent, if the
management system is the recov€
and easy to access and manipulate, then use of a database n-ay t
, best available alternative'
struch
state t
to the operation A
There are many functions a DBMS selves that are key components
DBMS in your business' first iost. ,
of database management. when deciding to implement a
youmustdecidewhattypeofDBMSyouwant.CommontlpesofDBMSarethe Tourn;
Each kind of database
relational, network, hierarchy and object oriented models. maint;
structure has its own Pros and cons' datab;
of
while each is unique in its own way, there are some standard functions
a
d) Se<
DBMS, and those are:
Se
,yr inc
If system failure occurs, DBMS must provide ways to recover a database so that
data is not permanently lost. There are times computers may crash, a
fire or other and f<
::ima
natural disaster may occur or a user may enter incorrect information invalidating
or
making records inconsistent.
lon Database Management Systems 1-3 Introduction
ure If the database is destroyed or damaged in arry way, the DBMS must be able to
the recover the correct state of the database and this process is called Recoaery. The easiest
way to do this is to make regular backups of information. This can be d.one at a set
strucfured time so in the event a disaster occurs, the database can be restored to the
state that it was last at prior to backup.
10n A disadvantage to this is any data or changes entered after the backup would be
irst lost. A way to counteract this is to set the DBMS to provide a feature called
the
Journaling' This involves keeping a log of all updates made to the database, it is
ase maintained in a file separate from the database and can be obtained to re-update the
database after it is recovered from the backup.
fa
d) Security
Security is the prevention of unauthorized users accessing the database.
DBMS uses features such as encryption, authentication" authorization and views to
ase provide security to the database. In encryption DBMS converts the data in a database
rint to an indecipherable format. No unauthorized person trying to access this information
will be able to read it. Authorized users will be able to see it in normal form.
ing Authentication is a technique in which the database administrator can identify the
be
Person accessing the database. Authorized users are given passwords and successful
the entry of a valid password will allow the user entry into the databas e, 7f a password is
the not successfully entered, the user will be denied access. Authorization is a set of rules
that the database administrator (DBA) sets up to specify levels of usage that
individuals or groups are allowed to have. Some users may only be allowed viewing
options, while others may be allowed to both view/make changes.
rase
In some circumstances/ users may only be allowed to access certain pieces of the
rent database, and be denied access to areas that does not relate to their specific needs. In
tis these cases, the DBA will assign workgroups, and these workgroups will be assigned
rate levels of access and permissions. In views DBA allows certain users the ability to view
the tables or fields that pertain to them, any other view does not exist for them in the
i.g, database, DBMS does this behind the scenes and to the user it appears that the
are information they see are the only existing data.
rase
e) Data integrity e
Without any of the above iisted functions, a database would not be able to r.r,'ork T]
effectively. Each of these functions play an important role in database management. ;onsi:
-\ppii
1.2 Database Systern Applications
Database is widely used all around the rvorid in different sectors. Various n
L
applications of DBMS in these sectors are given below:
1. Banking : For customer informatiory accounts, loans and banking transactions.
2. Airlines : For reservations and schedule information. Airiines were among the
first to use database in a geographically disturbed manner-terminals situated
around the world accessed the central database system through phone lines
and other data networks.
3. Universities : For student information, course registrations and grades.
4. Credit card transactions : For purchases on credit cards and generation of
monthiy statements.
Ih
5. Teiecommunications : For keeping records of calls made, generating monthly l:L,le
bills, maintaining balances on prepaid calling cards and storing information
about the comrnunication networks. Frt
:-. f S\-S
6. Finance ; For storing information about holdings, sales and purchase of
financiai instruments such as stocks and bonds.
7. Sales : For customer, product and purchase information'
8. Manufacturing : For management of suppiy chain and for tracking production
of items in factories, inventories of items in warehouses,/stores and orders for
items.
9. iiuman resources: For information about employees, salaries, payroll taxes and
benefits and for generation of paychecks.
10. Web based services : For taking web users feedback, responses, resource '/-.3.2
sharing etc.
il Data
1.3 File Processing System Sin
: long
1.3.1 Introduction to File Processing System -...ritten
:
The information can be either a conventional file processing system or a database -iplicz
system. In the conventional file processing system, each and every subsystem of the r--:stom
:^:coun
information system will have its own set of files. As a result, there ',adll be duplication
of data between various subsystems of the information system. But, in database :-ar- le
systems, there is a single centralized database which minimizes the redundancy of -,rnger
data to a greater extent. For
ie, bu
Database Management Systems 1-5 Introduction
The concept of the conventional file processing system is shown in Fig. 1.1, which
consists of three application/subsystems, namely Application X, Application Y and
Application Z.
executions may leave the account in an inconsistent state. The account may contain v
either g 450 or $ 400, rather than $ 350. In order to guard against this possibility, some stand
form of supervision must be maintained in the system.
v) Se
v) Security problems
t
Not every user of the database system should be able to access all the data. For can c
e.g. in a banking system, pay roll personnel need only see that part of the database
that has information about the various bank employee. They do not need access to vi) In
information about customer accounts. Since application Programs added to the system II
in an ad-hoc manner, it is difficult to enforce such security constraints. data
the d
vi) lntegrity problems
The data values stored in the database must satisfy certain types of consistency
constraints. For e.g., the balance of a bank account may never fall below a prescribed
Database Manageinent Systems 1-7 lntroduction
amount (say $ 100). These constraints are enJorced in the system by adding
appropriate code in the various application programs. However, when new constraints
are added, it is difficult to change the programs to enforce them. The problem is
compounded when constraints involve several data items from different files.
AdatabaseSystemgenerallyprovideson-lineaccesstothedatabaseformany
is often designed to meet a specific need and
users. In contrast, a conventional system
thereforegenerallyprovidesaccesstoonlyasmallnumberofusers.Becauseofthe
when a database is used, the enterprise may
larger number of .,*,, accessing the data
involve additional risks as compared to a conventional data processing system in the
following areas:
of the database. l
the
iii) The Gost of using a DBMS
,
mair
Database systems are costly as comPare
to conventional data processing systems'
1)Databasesystemshar,efewgraphicalorstatisticalcapabilities.
data'
2) Proprietary formats may limit archivai quality 1f
resourcEs to administer'
3) Database systems require expertise and
4) Database damage
database' If database is
In most organizations, all data is integrated into single data is lost forever'
corruption, valuable
damaged due to electric failure or database
Database Management SYstems 1,9 lntroduction
etion
ase ls iii) Viewlevel : It is the highest level of abstraction that describes only part of the
rer.
entire database.
Database Management Systems 1-10 lntroduction inr
Fig. 1,.2 shows the relationships among the three levels of abstraction. 1.7 I
-&l
lL:r:E
lvb*l l"*rl -
...@q
-,:*
:
_1
;aiai
-+t.w
:--y
.T1
1
i
Fig. 1.2 The three levels of data abstraction
i
At the logical level, each record is specified by Vpe definition. For example, we a
declare a record as :
a
struct Customer
a
{
a
int Customer_id;
char Customer_name [20] ;
1.8.1
char Customer address[3O] ;
t.
The r
Finally, at the view level, computer users see a set of application programs that
hide details of the data types.
Database Management Systems 1-11 Introduction
1.8.1 ER Model
Ihe entity relationship (E-R) model consists of a collection of basic objects, called
errtities and of relationships among these entities.
. Entity : An entity is a 'thing' or 'object' in the real world that is
distinguishable from other objects. For example, each person is an entity, and
bank accounts is an entity.
Entities are described in a database by a set of attributes. For example, the
attributes of account entity are account_no and balance.
lntroduction tlataba
Database Management SYstems 1-12
a
entities' For
. Relationship : A relationship is an association among several
a
example,adepositorrelationshipassociatesacustomerwitheachaccount
thatshehas.Thesetofallentitiesofsametypeandthesetofall
relationship
relationships of the same type are termed as an entity
set and - Dis
a
set, resPectivelY.
graphically by an E-R
The overall logical structure of a database can be expressed 1.8.2 |
Table
Account No Balance
900 500
101 2000
249 3000
303 900
physiial data storage details, the designers can concentrate on the logical a
view of the database.
o
. Design, implementation, maintenance and usage ease : The relational
database model achieves both data independence and structural
independence making the database design, maintenance, administration and a
1.8.4
T1
replac
alnOni
mode
allowr
two d
. Implementation complexity :
Although the hierarchical database model is
conceptually simple and easy to design, it is quite complex to implement.
o Database management problems : If you make any changes in the database
structure of a hierarchical database, then you need to make the necessary
changes in all the application programs that access the database. Thus
maintaining the database and the applications can become very difficult.
o Lack of structural independence : Hierarchical database system use physical
ks
storage paths to nevigate to the different data segments. So if the physical
ne
structure is changed the applications will also have to be modified. Thus, in
a hierarchical database the benefits of data independence is limited by
strucfural dependence.
se
Linkages are only possible vertically but not horizontally or diagonally, i.e. there is
no relation between different trees at the same level unless thev share the same
parent.
.iA
Fig. 1.6 shorvs a sample network model.
: - _1-:
: :---'
r - -:- -'.
1 l'1.=
i.8.7
o Conceptual sinnplicity : ]ust like the hierarchical model, the network model
is also conceptually simple and easy to design.
. Capability to handle more relationship types : The network model can
handle the one-to-many (1 : n) and many-to-many (n : n) relationships. ahi
1-18 lntroduction E
Database Management SYstems
Data manipulation is : a
o The retrieval of information stored in the database'
o The insertion of new information into the database' . .1o.1
The DML
:' *-
Declarative DMLs are easier to learn and use than procedural DMLs'
component of the SQL language is nonprocedural'
: ApF
o Insert : Insert data into a table. t\
For examPle : ---:
insert into account values
('A101"1000); a-- ---
'A101' ;"<: :
Above SeL DML statement inserts a record with values account-no =
and balance = 1000 into accor-rnt table' *\E
a) Naive useni
They are unsophisticated users who interact with the system by invoking one of
the application programs that have been written previously. For example, a bank teller
who needs to transfer $ 50 from account A to account B, invokes a program called
rus to
transfer. This program asks the teller for the amount of money to be transferred, the
account from which the money is to be transferred, and the account to which the
what money is to be transferred.
The typical user interface for naive users is a forms interface, where the user can
DML fill in appropriate fields of the form. Naive users may also simply read reports
generated from the database.
b) Application programmers
There are computer professionals who write application programs. Application
Prograrruners can choose from many tools to develop user interfaces. Rapid
Application Development (RAD) tools are tools that enable an application programmer
to construct forms and reports without writting a program. Application progranuners
\101' also uses fourth generation languages to facilitate the generation of forms and the
display of data on the screen.
c) Sophisticated users
They interact with the system without writting programs. hrstead, they form their
[he requests in a database query language. They submit each such query to a query
ery
Processor, whose function is to break down DML statements into instructions that the
ton storage manager understands. Analysts who submit queries to explore data in the
database fall in this category.
Database Management SYstems 1 -20 lntroduction bl
. .i
Online analytical processing (OLAP) tools simplify analysts tasks by letting them
view summaries of data in different ways. For instance, an analyst can see total sales
by region (for example, North, South, East and West), or by product, or by -l-:
combination of region and product (that is, total sales of each product in each region). r -:':!
Another class of tools for analyst is data mining tools, which help them to find
certain kjnds of patterns in data. -*1-5
d) Specialized users
These are sophisted users who n'rite specialized database applications that do not
fit into the traditional data processing frame work. Among these applications are
computer aided design systems, knowledge base and expert systems, systems that
store d,ata with complex data types (for example, graphics data and audio data) and
envirorunent rnodelling sYstems-
. Periodic backup, either onto tapes or onto remote Servers, to prevent loss 3\ECL
rterl
;tion Database Management Systems 1-2'l Introduction
Lnd
One of major objectives in developing a database is to create an information
resource that can be shared by many users. If transactions execute one at a time, i.e.
is
serially,with each transaction doing a commit before the next one begins there is no
problem of interference with one another's transactions. However, users often need to
access data simultaneously. If all users are reading data, there is no way they can
interfere with one another and there is no need for concurrency control. If users are
Database Management Systems 1 -22 lntroduction
n
accessing different parts of the database, their transactions can run concurrently
without a problem. However, when two users try to make updates simultaneously on
the same data, or one updates while another reads the same data, there may be
conflicts. To avoid such conflicts, there is need of concurrency control mechanism.
Thus, the concurrency control is a :
A database system is partitioned into modules that deal with each of the
responsibilities of the overall system. The functional components of a database system
can be broadly divided into the storage manager and the query Processor components.
Fig. 1..7 (See on nexi page) shows the overail system structure.
ttly
Naive user
on (tellers, agents,
be web-users)
IL
;e
)f
Query processor
Authorization
and integrity
manager
I Storage manager
the
em
rts.
Disk storage
ow
ted
file
vel
n8,
' File manager : Itmanages the allocation of space on disk storage and the
data structures used to represent information stoied on disk.
o Buffer manager : It is responsible for fetching data from disk storage into
main mernory and deciding what data to cache in main memory.
Ans.
r Storage manager : It implements several data structures as part of physical
svstem implementation. Q,3
r Data files, n'hich store the database itself.
r Data dictionary : It contains metadata that is data about data. The schema of Ans.
a table is an example of metadata. A database system consults the data
clictionary before reading and modifying actual data. Q.4
o Indices, which provide fast access to data items that hold particular values.
Ans.
1.12.2 Quely Processor
The 'luery processor is an important part of the database system. It helps the Q.s
database system to simplify and facilitate access to data.
The querv processor components include :
r f,)DL Ans.
interpreter, which interprets DDL statements and records the
definitions in the data dictionary. b
. DML compiler, which translates DML statements in a query language into :atat
an evaluation plan consisting of low-level instructions that the query ahl's
--l -dLl
-
evaluation engine tmderstands. =ld
A quely can be translated into any number of evaluation plans that all give
the same result' The DML compiler also perform query optimization, that is, it
picks up the lowest cost evaluation pran from among the alternatives.
r Query evaluation engine, which executes low-level instructions generated by
the DML compiler.