Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Security problems In database sy'stem we may create different user accounts and provide

dferent authorizathion to difterent users. Thus we are able to hide certain information fronm
somne users For example, in a banking system, payroll personnel need to see only that part of
the database that has information about the various bank employees. They do not need access
to mormation about customer accounts. This type of restriction is essential for security
parpase. But file prooessing system do not allow us to create user accounts thus all users have
egual access to the data. Due to this it is difficult to maintain security of flat file systems. Besides
this file processing systems do not have any provisions for periodic backup of data and
recovery from data loss which are provided by database management systems.

1.4.2Advantages of Flat-file Systems

Despite of the number of drawbacks of flat-file systems they are beneficial in many situations
and database management systems may not be much suitable in such situations. Benefits of file
processing systems or we can limitations of daabase management systems are described below

Initial Investment: To use database systems we need to purchase database management


system based on our requirement. Besides this we may need to purchase a powerful
computer to run it as database server. Due to this reason initial inves tment is high if w
use database management system. But such high initial investment is not needed for flat-
File sy'stem. It can be executed is existing infras tructure or we may need to purchase
general purpose desktop computers.
Dedicated Staff: To manage database systenm efficiently we need to hire a skilled
dedicated staff called database administrator. File processing systems do not need to hire
such dedicated.
Overhead: We need to update and maintain database systems in periodic basis to make it
efficient in new technologies which is not needed in flat-file systems. Thus overhead cost
is high for database management systems.

14.3When Flat-File Systems are suitable

Based on above discussion we can say that database management systems arte always not
suiable to use. Flat file systems are more suitable to use rather than database management
systems in following situations:
When system to be developed is simple and small
When we need to manage few data (up to 2-3 data files)
When security is not major concern
When concurrent access is not needed

1.5Application Areas of Database Systems


Database systems are widely used in different areas because of their numerous advantages.
Some of the most common database applications are listed here.

Airlines and railways: Airlines and railways use online databases for reservation, and for

displaying the schedule information.

Chapter-1 inroduction to DotoBases System7


databases for customer inquiry, accounts, Joans, and o e
Banking: Banks use

transactions.
registration, result, and

Education: Schools and colleges use databases for course


other
information.
Telecommunications: Telecommunication departments use databases to tore
Cal
information about the
communication network, telephone
numbers, record of
calls, for
bills, etc.
generating monthly
Databases are used for keeping track of purchases on e.

Credit card transactions:


statements.
cards in order to generate monthly
information sources (tor example, catalogs:
E-commerce: Integration of heterogeneous
online shopping booking of holiday package, consultin
business activity such as
doctor, etc.

information systems and electronic patient


record: Databases are used f
Health care

health care details.


maintaining the patient
Databases are used for management anc
Digital libraries and digital publishing:
textual and multimedia data.
delivery of large bodies of
Finance: Databases are used for storing information such as sales, purchases of stocks and
bonds or data useful for online trading.
Sales: Databases are used to store product, customer and transaction details

Human resources: Organizations use storing information


databases for about their
checks.
employees, salaries, benefits, taxes, and generating salary
for

1.6 Database Instances and Schemas


The overall structure of the database is called database schema. In the relational model the
schema for a relation specifies its name, the name of each field (or attribute or column), and the

type of each field. For example, employee information in a company database may be stored in

a relation with the following schema:

Employee (Eid: string, Ename: string, Address: string, Salary: integer, age: integer)
The preceding schema says that each record in the Students relation has five fields, with field
names and types as indicated. Once created, database schema is not expected to chang:
to the level ot
frequently. Database systems have several schemas partitioned according
abstraction such as physical and logical schema. Database administrator is responsible for

creating, deleting and modifying database schema.

The collection of information stored in the database at a particular moment is called an


instara
of the database. It is the actual content of the database at a particular point in tinme. Databas
instance changes frequently with every insertion, deletion and update operations performed t

Kriti'sintroduction of Dato Bases


data stored in a database. For example, one instance of database for above relation schema can
be given as below:
Eid Ename Address Salary Age
EO1 Ayan Kathmandu 35000 25
E02 Bishnu Pokhara 27000 28
E03 Dina Dharan 25000 26
E04 Bhanu Ghorahi 32000 37
E05 Renuka Dhangadhi 28000 27

Insertion of data causes change in instance

Eid Ename Address Salary Age


E01 Ayan Kathmandu 35000 25
E02 Bishnu Pokhara 27000 28
E03 Dina Dharan 25000 26
E04 Bhanu Ghorahi 32000 37
E05 Renuka Dhangadhi 28000 27
E06 Elish Mahendranagar 30000 25

Figure: Change in instance due to insertion of new data


1.7 Data abstraction
Data abstraction is the process of easy interface to uisers by hiding underlying complexities of
data management from users. Database System provides users with an abstract view of the
data. Data abstraction is provided in database management systems by using three-level
schema (ANSI /SPARC) architecture.

1.7.1 Physical level nteena leve ]


It is the lowest level of abstractions and describes how the data are actually stored on disk and
Some of the access mechanisms commonly used for retrieving this data. While designing this
layer, the main objective is to optimize performance by minimizing the number of disk accesses
during the various database operations. This level must decide what file organizations to use to
store the relations, and create auxiliary data structures called indexes to speed up data retrieval
operations. The database system hides many of the lowest level storage details from database
programmer. DBMS developer is the person who deals with this level. Database administrator
may be aware of certain details of the physical organization of the data

Chapter-1 ntroduction to Data Bases System


View Level

View 2 View N 1.8


External/view
Level
View1
The
Logical Level ass
Conceptual Level SC

Physical Level
Internal Level
ad

ex
Stored database

data abstraction
Fig: Three levels of
Lover
1.7.2 Logical level
Cconce ptual
what data are stored in the
of data abstraction which describes
level
It is the next higher those data. It is also known as conceptual
level at
exist among
database, and what relationships level describes the
schema (conceptual schema). Logical
the schema at this level is called logical the conceptual
a relational DBMS,
of the data model of the DBMS. In
stored data in terms
stored in the database. Programmers
relations (tables) that are
schema is described by using do not need to
this level of abstraction. Database users
works at
and database administrator
have knowledge of this level.

Texternal Lenel
1.7.3 View level
database and hides some

level of abstraction and


describes only a part of the
It is the highest
users see a set of application
programs that
information from the
At
user. view level, computer defined
views of the database are
at the view level several
hide details of data types. Similarly called external schema
views. Schema at this level is
these
and database user see only are not stored in
the
a relation, but
the records in a view
(subschema). A view is conceptually relations stored in the
a definition
for the view, from
DBMS. Rather, they are computed using users fronm
mechanism to prevent
role to provide security
DBMS. Views also plays vital hide information (such
as an
is views can also
certain parts of the database (that
accessing
employee's salary) for security purposes.)

1.8 Data Independence


The capacity
architecture further explains
the concept of data independence.
The three schema called data
programs is
database schema without affecting application
to change the of data independence:
Data Logical
Database system provides two types
independence.
Data Independence.
Independence and Physical

Kriti'sIntroduction of Data Bases 10


1.8.1 Logical Data Independence

The capacity to change the conceptual (logical level) schema without


having to change
associated application programs is called logical data independence. Relations in the external
schema (view relations) are in principle generated on demand from the relations corresponding
to the conceptual schema. If the underlying conceptual schema is changed, the definition of a
view relation can be modified so that the sanme relation is computed as before. Database
administrator is responsible for redefining view level schema.

The correspondence between a particular external view and the conceptual view is called
external/conceptual mapping. For example, field names can be changed; several conceptual
fields can be combined into a single external field; and so on. When modification is done to the
conceptual schema (i.e tables) only the external/conceptual mapping need to be changed, if the
DBMS fully supports the concept of data independence.

1.8.2 Physical Data Independence


The capacity to change the internal schema without affecting application programs is called
physical data independence. This means we can change physical level storage details such as
file structure; indexes as long as conceptual schema remains same without altering associated
application programs. But performance may be affected due to changes in physical level
in ternal schema).

The correspondence between the conceptual view and the stored database is called
conceptual/internal mapping It specifies how conceptual records and relations (files) are
represented at the internal level. If a change is made to the storage structure definition, then the
conceptual/internal mapping must be changed accordingly, so that the conceptual schema can
remain invariant. It is the responsibility of the DBA to manage such changes.
1.9 Database Languages
Languages that are used to interact with dalabase management systems are called database
languages. DBMS provides two languages: Data-Definition Language (DDL) and Data
Manipulation Language (DML).
1.9.1 Data Definition Language (DDL)
Database language that is used to create, delete or modify database schema is called data
definition language. DDL statements are converted into equivalent low level statements by
DDL interpreter. DDL is used by the database administrators or database
the conceptual schema of a database. In many DBMSs, the DDL is designers to specify
also used to define internal
and externai schemas (views). Results of DDL statements are
recorded in
dictionary. Structured query language supports following DDL statements:special
file called data

Create statement Drop statement Alter statement


The DDL provides the facilities to define: Database schema, Database
constraints, views, Security and Authorization, tables, Integrity
statement is given below: Modify the Schema etc. of Example a DDL

Chopter-1 Introduction to Doto Bases System


CREATETABLE account

Account-1umber CHAR (10),


INTEGER,
Balance
Branch CHAR (10)

and it updates a special set ad


statement creates the account table of
Execution of the above DDL file that stored metadata. Dath
Data dictionary is a special
tables called the data dictionary. information about concephual
we can say that
is called metadata. More accurately
about data
database schema is stored in data dictionary.

Language (DML)
.9.2 Data Manipulation from database is
called
Database language
update, and retrieve data
that enables insert, delete, data manipulation
data manipulation language (DML). Query
language is only a part of
low level statements by DML
are converted into equivalent
language. DML statements DML statements:
Structured query language supports following
compiler.
Insert statement
Delete statement

Update statement
Select statement
Example of a DML statement is given below:
Insert into Employee values ("A01", 456000, "Patan");
relation
Execution of above DML statement causes one record to be insertion into the employee
and hence causes database instance to be changed. There are basically two classes of DML:

Procedural DMLs: In procedural DMLS, a user specifies what data are required and
how to get those data. These are normally low level data manipulation languages
Relational algebra is an example of procedural DML.

Nonprocedural DMLs: In nonprocedural DMLs a user specifies what data are needed
without specifying how to get those data. These are normaly high level dat
manipulation languages. Structured query language (5QL) is an example of
nonprocedural DML.

Part of data manipulation language that can be used to retrieve data from the database is called
query language and the DML statement that is used to retrieve data is called query. Example of
SQL query is given below:

SELECT

FROM account
WHERE balance <1000

Execution of this statement retrieves the records of all accounts in which balance is below 1000.

Krit'sIntroductionof Dota Bases12


1.10 Transaction Management
Collectioms ot operations that orm a single lng1cal unat of wrork are caled transacthons For
evample a transfer ot hunds trem a checkang aceount to a savings account is a samge operaio
m t h ecustommers stamapoant twzthun the datalbase sysem, however, it
comsisits ci several operations A database systerm must ensure proper Read (A
eecution rarsactions despule tanlures-enther the entire ransaction A =A -10 000
ENecutes or none ot it does Lonsder the example of transaction that Wite
ansiers 1a,000 Rs from account A to account B Assume inbal balarnce of Read 1B
arcount A and Bis d0,J00 Rs and 80,000 Rs respectively B B-10.000
Nite B
actions access data using two operations

Readix Nhach transiers the data item xfrom the database to a


local bufier belonging to the transacbon that executed the read operation

from the local buffer of the transaction that


Write x: Which transfers the data iter
eNecuted to the database
ACD
To ensure integritr of the data we require that the database system must satisfy
stands tor atomiity. C stands for consistency. stands for isolation and
properties where A
D stands for durability
the transaction are reflected properiy ir the databaa
Atomicity Either al operabiens of
executon af transacions is not allowed Suppose
or none are his means parial
transaction a falure occurred after the
wrie (A)
during the eerution of above
Then the values of amount refñected in
operation but before write B) operaion
10,000 as a result of failure
database wil be 50,000 and 80,000 The system destrored
consistent state to
of a transaction mast take database from
one
Comsistency: E tion
here is that sum of A and B be
amother consistent state. The consistency requirement
the consistency requirement
unchanged by the execution of trarsaction Without
or destroyed by a transaction
money could be creabed
of of transactions is equivalent to soma
Isalatiom: Effert of a concurrent execution group
DBMS allows users to think of their programs
serial euecution of all ransactions
in isolation, one after the other in some order
sactions as if they were exetuting ransactions will not be interleaved in sudh a
chosen by the DBMS Steps of
concurrent

interfere with each other


way that they
the database and the changes are commited
Durabiliry Cnce a ransaction changes
lost because of subsequent failure.
dhese changes must never be

1.11 Database users

asset of business Io desigm, use.


and maintain such important anset
Database is an important
databases include database users, system
involved. The people who work with
may peopie are those
and database adiministrator (DBAJ Database users are
analysts, application programmers, and update the database, and generale reports
who interact with the database in order to query
database management systems database users are
Onthe basis of way interacting with
classified into the following categories
r d t i e an Dco Bses System3
Ohaer
the database by invoking s4m al
updale
Naive users: The users who query and
F'or example, the o w n e r
of the bookstore enter
bookstore nters
Written application programs.
invoking appropriate applir ation utrner
details of various books in the databan by
he database using form interlace
The naive user interacts with
busiriess analyst, srientist, et., who are famil,
The users, such as la
Sophisticated users:
with the system without writing
a DBMS interart aty
with the facilities provided by to retrieve informatis
application programs. Such
users use query language
database
natio
from the database to meet their
complicated requirements
database programs, which
Specialized users The users who wrile specialized
applications, such as banking and payro
different from traditional data processing ations such a
data types. Specialized users vite applir
management which use simple and expert systems that stort dat
computer-aided design systems, knowledge-base
having complex data types.
are the computer professionals
who implement the
Application programmers: They
and develop application programs. The
specifications given by the system analysts,
database application programmer develops application program to facilitate easy dat
access for the database users.

1.12 Database Administrator


Database administrator (DBA) is a person who has central control over both data and
DBA vary depending upon the job description and
application programs. The responsibilities of
DBA are given here.
corporate and organization policies. Some of the responsibili ties of
Schema definition and modification: The overall structure of the database is known
as database schema. It is the responsibility of the DBA to create the database schema by
executing a set of data definition statements in DDL. The DBA also carries out the
changes to the schema according to the changing needs of the organization.
New software installation: It is the responsibility of the DBA to install new DBMS
software, application software, and other related software. After ins talla tion, the DBA
must test the new software.
Security enforcement and administration: DBA is responsible for establishing and
monitoring the security of the database system. It involves adding and removing users
auditing, and checking for security problems.
Data analysis: DBA is responsible for analyzing the data stored in the database, and
studying its performance and efficiency in order to effectively use indexes, parallel
query execution, etc.
Preliminary database design: The DBA works along with the development team
during the database design stage due to which many potential problems that can arise
later (after installation) can be avoided.
Physical organization modification: The DBA is responsible for carrying out the
modifications in the physical organization of the database for better
Routine maintenance checks: The DBA is responsible for
performance.
taking the database backup
periodically in order to recover from any hardware or software failure (if occurs). Other
routine maintenance checks that are carried out by the DBA are
and ensuring the availability of free disk space for normal
checking data storage
space as and when required, etc.
operations, upgrading disk
Kriti'sIntroduction of Doto Boses 14

You might also like