DBMS
DBMS
In early days, data was stored as text files. Later, varíious methods were
developed for structured data storage. This chapter will explore the concept
of database and its comparison with conventional files system. Database
Management System (DBMS) is a valuable tool for manipulating
computerized information. With the aid of this tool, the process of storing,
is greatly simplified. Here we learn the structure
retrieving and modifying data
and components of DBMS. Database abstraction, the types of users of DBMS
and the different data models are also discussed here.
11.1 Introduction
Information is a key word in modern management. As anyone with a
11.2 Databases
1. Data Redundancy
advantage of database is that all the data is kept at one place. All the
database.
should
Incidentally, this does suggest that all redundancy can or
not
student address
copies of the same data may not agree. For example, a changed
and Course Mark files. Clearly, a
may not be reflected in Tuition Billing
database that is ín an inconsistent state is capable of supplying incorrect
or
Sharing of data means that the «data Mored in the datalbase can be shared
among several users or programs and each may use it lor dilferent purposes
Sharing means not only that the existing application program can
share the data in the database, but also that be
new
prograns can
developedd
to
operate on the same data.
private.
Data security resers o the protection of data against accidental
inenional disclosure or unauthorized destructión
or
unauthorized persons.)
or modification by
(The various
prograins and users may hare data in connmon. But
access
to
specilic inforation can be limied to selected
user)Through the use of
passwords, the iniomation in a database is made available
have a legitimate only to those who
righi
1o access il.
4 Structure of DBMS
Databases consist of a collection of data that is used by application
and retrieval of
programs of given enterprise. For effective storage
a
1. Fields
A field is the smallest unit of stored data. Each
fields consists of data of
Student database can be RollNo,
a specific type. For example, the fields of
Name consists of
Name, DateofBirth, etc. Here Rollno is integer type,
characters and DateofBirth is a date.
2 Record
collection of related fields. For example, the group of
A record is a
student such as
fieldsrepresenting personal information about a particular
record.
his RollNo, Name, DateofBirth, etc. constitute a
3. File
A file is a collection of all type of record. A Personal
occurrences of one
Database ehemna
Pakaboe Lnatan t
a skeleto shuet coe
ih at epnesents Re legtcal Databasc sho skol cpealinal
da abue
Vic he enlne Files database data a
t delnes heu Rhe data
IE
IS nised heuw Hhe C Ven tme
Changs wt time
eltus aneng m Field
a s Seiate d
ersnet cten tnin data).
101 Raju 65 75 Record
The main
component of DBMS is the database itself. Database is an
organized collection of infor mation. The database consists of structuures to
hold this information.
b. Data Definition Language (DDL) ued to dne dala skucluu
A database schema is
specified by a set of definitions
expressed in a Ca paticula
eu s special language called data definition language. The result of compilation of
s c h m a dalabase, D S t a t e m e n t s 1s a set of tables that is stored in a special file called Data
way ogaes
data t a
Dictionary.
Compul eq:ai=
A data dictionary is a file that contains
data, that is, data about
a REATE, data. This file is consulted before actual data
meta
or
manipulate data as organized by the appropriate data model. DML provides
the techniques for procesing database such
a as retrieval, sorting, display
and deletion of data
records.)
315
omputereloneeSd KI
Data Manipulation Language provides interfaces with programming
languages. lt allows users and application be
physical data storage.
programs to
independent of
d. Users
Users interact with the DBMS
indirecthy via application programs or
directly via simple query languages. The user's interactions with the DBMs
include the definition of logical
relationships in the database and manipulation
of data.
Users
Applcat.on Phaghanm
Debabase Adminicat
n d Ustrs DML Compiler DDL Interpreter
Database
Management
System
Consider a banking enterprise that can have several record types like
Customer that stores customer details like AccountNo, Name, Address, etc.;
Account that contains AccountNo, alance, etc. and Employee that store
Name, Dateoforning, Salary, etc. of the employees in the bank. We will discuss
the different levels of abstraction based on this example.
316
dala abshaclion .
H.ding ukvant details rom
/Hiding
Computor
Suienco Std XI
Abstraction
11.6.1 Levels of Database
a.
.
Physical Level
level describes
T1 desenbee This is the lowest level of abstraction.The physical
low-level
aclual stored in the storage
medium. Complex
how the data is actually
Sloyed tm etatabese
is
data s t r u c t u r e s are described in detail at this level.
data
actual storage
records will be stored in
At the physical level, the
he
memory as bytes.
The database hides these
locations in primary
or secondary
details from the programmers
dkibet
tcha
b. Logical Level
The logical level is the next higher level of abstraction. It describes,
sletud what data are stored in the database and what relationships exist among those
data Here the entire database is described in terms of simple structures. The
databasa.
aata
logical level of abstraction is'used by databasé administrators, who must decide
what information is to be kept in the database. The description at this level is
independent of the actual data storage details.
The records are defined at the logical level. That is, the type of data
(Name as character, AccountNo as integer, etc.) and their relationships are
specified here. Programmers work at this level using a programming language.
AccountNo Integer
Name Character (30)
House Character (20)
Locality Character (20)
City Character (15)
Fig. 11.4 Structure of Customer record
317
wwww. wwww
Commputer Scionce Std XII
c. View Level
c i b
way
the data. It describes only
E o s
part of the entire database. Most of the users of
a
Database Administrator
The Database Administrator (DBA) is a person who has a central control
over the data and programs that access data in a DBMS. He is in charge of
creating, maintaining and modifying all the three levels of the DBMS. He
controls the allocation of system resources, access to users and ensures
consistency of the database.
b. Application Programmer
Application programmers are computer professionals who interact with
the DBMS through application programs. Application
programs are programs
written in any host language (for example Visual Basic, C, C++, Pascal) and
interact with the DBMS through DML calls. An application programmer
defines the conceptual view for the database using the internal structure
defined by the database administrator.
C. Naive Users
Naive users are unsophisticated users who interact with the system by
invoking one of the application programs written previously. He is not
concerned with or even aware of the details of the DBMS. Typically he does
only querying and updation. Naïve users deal only with the highest level of
abstraction.
320 o
he loqical drrigu gbucha
A database edl dfivnes alt3ecl
hru) dala mtll he chone d,
a
datahate imd definee
on. ated a DPMS
Computer Suience Std XI
n e
doki
t s l o n e . di n i d ehe
data, data relationships, data semantics and consistency problems. Database
systems are generally based on one of the three models - hierarchical, network
or relational.
a. Hierarchical Model - o Yganises data into a thez lke s t u d u , w h a
The hierarchical model assigns records to different levels of a hierarchy. Stngle neot
A lower level record is called a child and a higher level one is called a parent. fo ewch all
The parent record at the top of the database is called the root record Any he oheY data
makes payment by cash, card or cheque and his address is noted down. The
ehalá ne da o
database model for department store is given below.
ha parnt nedc3-
(Date, Time) A ctueld nede caun
Date
have only onc
(Name, Address)
Customer
(Type of payment, Amount)
Payment
(Item code, Name, Price)
Item
****
b.
b. Network Model
The network model is similar to the hierarchical model, but each child
record. This model eliminates the
record can
have more than one parent
encountered in the previous case. The network model was
redundancy
Systems Data Languages
proposed by CODASYL-DBTG (Conference
on
.322 Wwww
Computer Boieme Std XI
Relational Model
the concept introduced by E F Codd
The relational model is based on
H a l n
databases.
in his seminal paper on the application of relational (set) theory to
Aelatons
elatcn:h
SrnatemhioM database, tables are called relations, rows
h a t a i w e db y
of
stored in different tables made up rows and columns. In a relational
ld
given below.
323
Computer Science Std XII3 wwww****
Payment
Date Time Customer Method ItemCode
10/01/2004 10 am Gita Cash 101
Item
ItemCode Name Price
101 AA 25
102 BB 25
103 CC 15
104 DD 20
105 EE 25
AdmNo RollNo Year Name Batch Father Mother | DistCode
Smitha D-01
11001 2001 Biju SCIENCE Ram
SCIENCE Thomas Mary D-01
11002 2 2001 Saju
Latha D-03
11003 1 2001 Renju COMMERCE Raju
COMMERCE| Mohan Reena D-02
11004 2001 Sajiv
2002 Aravind COMMERCE|SomanSecna D-04
D-02
2002 Binu COMMERCE Rajeev Bindu
1007 2 2002 Anand SCIENCE Mohan Sheela D-01
STUDENT relation
Total Rank
AdmNoSublSub2Sub3
11001 75 70 60 205 4
11002 70 80 50 200 5
11003 80 85 70 235 1
11004 90 55 80 225 2
11005 60 70 90 220 3
11006 50 75 60 185185 7
11007 70 65 60 195 6
MARK relatio
DistCode District
D-01 Kozhikode
D-02 Ernakulam
D-03 Kottayam
D-04 Trivandrum
DISTRICT relation
325
ComputerScience Std Xf
11.11 Terminologies in RDBMS
11.11.1 Relation
11.11.5 Cardinality
The number of nc.crcu)
rows or
relation. The relation tuples in a relation is called
STUDENT has cardinality of the
of the STUDENT seven
tuples and hence the
relation is 7.
Similarly, the cardinality
relation is 4. cardinality of the DISTRICcT
326
Computer Sujenco Std XI
11.11.6 Degree (
The number of attributes in a relation determines the degree of a
relation. The relation STUDENT has 8 columns and attributes and therefore
the degree of the STUDENT relation is 8. Similarly the degree of the
DISTRICT relation is 2.
11.12 Views
It is not desirable that all the users see the entire data in the database.
Security considerations may require that certain data be hidden from the users.
2 Anand SCIENCE