0 ratings0% found this document useful (0 votes) 8 views38 pagesdbmsmod1,2
database management system
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
Concept and Overview of DBMS
Ml
12
13
14
15
16
CHarTER CONTENTS
Introduction
Disadvantages of file system
Data Models
Three Schema Architecture
Data Independence
Database Users
1.7 Database Administrator
1.8 Database Languages
1.9 Summary
1.10 Solved examples
Ll
Model questions
1.12 WBUT Solutions
OBJECTIVES
At the end of this chapter, you will be abel to
Discuss the advantages and disadvantages of DBMS.
Discuss the data modals
Discuss the Three Schema Architecture
Define the Data Independence and Schema
Discuss the Database Users
Define the Database Administrator
Ooogaoaodna
Describe the Database Languages
CHAPTERDatabase Managment System
1.1 INTRODUCTION
‘A Database Management System (DBMS) is a set of computer programs that controls the creatin,
mmaintenaneéand the use ofa database, I allows organizations to place contro! of ‘database developmen
the hands GF database administrators (DBAs) and other specialistsA DBMS ts 8 system software packs
that helps the use of integrated collection of data records and files known 28 databases. It allows differe,
‘user application programs to easily access the same database, 'DBMSs may use any of a'variety of database
models, such as the network thodel ot relational model. In large systems, @ DBMS allows users and othe,
Sintec Wr we wet Yeteveroser tire Hrueraren way, Tnvtead Or MAUS We COMPS’ Programs iy
extract information, user can ask simiple questions in a query language. Thus, many DBMS packages provide
Fourth-generation programming language (4GLs) and other application development features. It helps to
specify the ogical organization fora database and access and use the information within a database. It provide
facilities for controlling data access, enforcing data integrity, managing concurrency, and restoring the database
from backups: A DBMS also provides the ability to logically present database information {0 users,
1.2 DISADVANTAGES OF FILE SYSTEM
sary, let’s lodk at a typical “file-processing system”
To see why database management systems are neces
supported by a conventional operating system.
‘The application is a savings bank:
‘© Savings account and customer records are kept in permanent system files.
© Application programs are written to manipulate files to perform the following tasks
= Debit or credit an account,
+ Adda new account.
* Find an account balance.
* Generate monthly statements.
Development of the system proceeds as follows:
‘New application programs must be written as the need arises.
New permanent files are created as required.
© but over a long period of tin files may be in different formats, and
© Application programs may be in different languages.
So the disadvantages of file system are as follows :
‘As we can see, there are problems with the straight file-processing approach,
Data redundancy and inconsistency
+ Same information may be duplicated in several places.
= All copies may not be updated properly.
© Difficulty in accessing data
* May have to write a new application program to satisfy an unusual request.
+ E.g. find all customers with the same postal code.
= Could generate this data manually, but it isa tedious job,
© [Data isolation
“= Data in different files.
* Data in different formats.
= Difficult to write new application programs,”
O Multiple users
= Want concurrency for faster response time.) ia Concept Arid Overview of DBMS
* Need protection for concurrent updates,
* _ E.g. two customers withdrawing funds from the same account at the same time - account
has $500 in it, and they withdraw $100 and $50, The result could be $350, $400 or $450
if there is no protection.
©. Security problems
= Every user of the ‘system should be able to access only the data they are permitted to see.
* Eg. payroll people only handle employee records, and cannot see customer accounts;
tellers only access account data and cannot see payroll data.
* Difficult to enforce this with application programs,
© Integrity problems
* Data may be required to satisfy constraints,
" E.g. no account balance below $25.00.
* _ Itis difficult to enforce or modify constraints within a file-processing system.
© No Data independency
These problems and others led to the development of database management systems.
13 DATA MODELS
Data Model is a collection of conceptional tools that describes ¢he sutructure of the data base.
Structure of the database includes data type, data relationship, data semantic and data constraints.
Data Model
High level Implementational Model or Physical or ‘Semi Structured
‘or Conceptual Model Representational Model or _low level Model Model
eg Record Based Model e.g. Frame Memory Model
Entity Relationship e.g.Network Model,
Model, Hierarchical Model,
Object Oriented Model Relational Model
The following are the different data models in Database Management Systems:
1. Relational Model : (RDBMS) - Relational DataBase Management system) A DBMS based on the relational
model developed by E.F. Codd, A relational database allows the definition of data structures, storage and
Tetrieval operations and integrity constraints. In such a database the data and relations between them are
organised in tables, A table is a collection of records and each record in a table contains the same fields,
a Properties of Relational Table
~~ @) Values are Atomic
-(b) Each Row is Unique
~ (©) Column Values Are of the Same Kind
(@) The Sequence of Columns is Insignificant
(©) The Sequence of Rows is Insignificant
~ (f) Each coloumn has a Unique Name
Certain fields may be designated as keys, It means that searches for specific values of that field will useDatabase Managment System
lexing to speed them up. Where fields in two different tables take values from the same set, a join
can be performed to select related records in the two tables by miatching values in those fields Omer go"
always, the fields will have the same name in both tables, For example, an “orders” table RB ton ir
(customer-ID, product-code) pairs and a “products” table might contain (product-code, price) pairs 4
calculate a given customer's bill you would sum the prices of all products ordered by that customer 1,
joining on the produet-code fields of the two tables. This can be extended to joining multiple tables ¢,
multiple fields, Because these relationships are only specified at retreival time, relational databases ry
classed as dynamic database management system, The RELATIONAL database model is based on Relational
Algebra,
2.Object Oriented Model : Object DBMSs add database functionality to object programming languages,
They bring much more than persistent storage of programming language objects. Object DBMSs extend the
semantics of the C++, Smalltalk and Java object programming languages to provide full-featured database
programming capability, while retaining native language compatibility. A major benefit of this approach is
the unification of the application and database development into a seamless data model and language
environment, As a result, applications require less code, use more natural data modeling, and code bases are
easier to maintain. Object developers can write complete database applications with a modest amount of
effort.
According to Rao (1994), “The object-oriented database (OODB) paradigm is the combination of object-
oriented programming language (OOPL) systems and persistent systems, The power of the OODB comes
from the seamless treatment of both persistent data, as found in databases, and programs.” In contrast to a
relational DBMS where a complex data structure must be out to fit into tables or joined together from those
tables to form the in-memory structure, object DBMSs have no performance overhead to store or retrieve a
web or hierarchy of interrelated objects. This one-to-one mapping of object programming language objects,
to database objects has two benefits over other storage approaches: it provides higher performance management
of objects, and it enables better management of the complex interrelationships between objects. This makes
object DBMSs better suited to support applications such as financial portfolio risk analysis systems,
telecommunications service applications, Warld Wide Web document structures, design and manufacturing
systems, and hospital patient record systems, which have complex relationships between data.
3. Semistructured Model: In semistructured data model, the information that is normally associated with a
schema is contained within the data, which is sometimes called “self-describing”. In such database there is
no clear separation between the data and the schema, and the degree to which it is structured depends on the
application. In some forms of semistructured data there is no separate schema, in others it exists but only
places loose constraints on the data. Semi-structured data is naturally modelled in terms of graphs which
contain labels which give semantics to its underlying structure, Such databases consume the modelling power
ofrecent extensions of flat relational databases, to nested databases which allow the nesting (or encapsulation)
of entities, and to object databases which, in addition, allow cyclic references objects. Semistructured data
has recently emerged as an important topic of study for a variety of reasons. First, there are data sources such
as the Web, which we would like to treat as databases but which cannot be constrained by a schema. Second,
it may be desirable to have an extremely flexible format for data exchange between separate databases.
Third, even when dealing with structured data, it may be helpful to view it as semistructured for the purposes
of browsing.
4, Entity Relationship Model: The entity-relationship model is, based on a perception of the world as
consisting of a collection of basic objects (entities) ard relationships among these objects,= Concept And Overview of DBMS.
© Anentity is.a distinguishable object that exists,
* Each entity has associated with it a set of attributes describing it
* xg. number and balance for an account entity
* Arelationship is an association among several entities,
* The set ofall entities or relationships of the same type is called the entity set or relationship set
* Another essential element of the E-R diagram is the mapping cardinalities, which express the
number of entities to which another entity can be associated via a relationship set.
1.4 THE THREE SCHEMA ARCHITECTURE
‘The goal ofthe three-schema architecture isto separate the user applications and the physical database.In
this architecture, schemas can be defined at 3 levels :
1. Internal level or Internal schema : Describes the physical storage structure of the database, The internal
Schema uses a physical data model and describes the complete details of data stotage and for database
2. Conceptual level or Conceptual schema : Describes the structure of the whole database for a community
of users. It hides the details of physical storage structures and concentrates on describing entities, datatypes,
relationships, user operations, and constraints. Implementation data model can be used at this level
3. External level or External schema : It inchides a number of extemal schemas or user views.Each
external schema’ describes the part of the database that a particular user is interested in and hides the rest of
the database from user. Implementation data model can be used at this level.
oye Expusers a
EXTERNAL EXTERNAL TERNAL
LEVEL VIEW VIEW
Extemal/conceptual
‘mapping
CONCEPTUAL,
LEVEL
Conceptual/interal mapping
¥
TEVEL INTERNAL SCHEMA
STORED DATABASE
Fig. 1.1: Three Level Schema ArchitectureDatabase Managment System
1.5 DATA INDEPENDENCE
1. The ability to modify a scheme definition in one level without affecting a scheme definition i
higher level is called data independence.
2. There are two kinds:
O Physical data independence
* The ability to modify the physical scheme without causing application programs io 4.
rewritten
* Modifications at this level are usually to improve performance
© Lofical data independence
= The ability to modify the conceptual scheme without causing application progra
rewritten
* Usually done when logical structure of database is altered
3. Logical data independence is harder to achieve as the application programs are usually heaviy
dependent on the logical structure of the data, An analogy is to abstract data types in programming
languages.
1.6 DATABASE USERS
The database users fall into several categories:
© Application programmers are computer professionals interacting with the system through DML
calls embedded in a program written in a host language (e.g. C, PL/I, Pascal).
‘These programs are called application programs.
The DML precompiler converts DML calls (prefaced by a special character like $, #, etc.) 10
normal procedure calls in a host language.
The host language compiler then generates the object code.
Some special types of programming languages combine Pascal-like control structures with
control structures for the manipulation of a database,
‘These are sometimes called fourth-generation languages.
They often include features to help generate forms and display data,
Sophisticated users interact with the system without writing programs.
O They form requests by writing queries in a database query language.
These are submitted to a query processor that breaks a DML statement down into instructions
for the database manager module,
Specialized users are sophisticated users writing special database application programs, These
may be CAD systems. knowledge-based and expert systems, complex data systems (audio' video),
etc
Naive users are unsophisticated users who interact with the system by using permanent application
programs (e.g. automated teller machine).
_ 1.7 DATABASE ADMINISTRATORS
“A database administrator (DBA) directs or performs al activites elated o maintaining a successful database
environment. Responsibilities include designing, implementing, and maintaining the database system:
‘establishing policies and procedures pertaining to the management, security, maintenance, and use of the
database management system; and training employees in database management and use.
Duties of the database administrator include:
_/Scheme definition: the creation of the original database scheme, This involves writing, a set of
5 10 be
OROR OO} TOsom Concept And Overview of DBMS.
definitions in a DDL (data storage and definition language), compiled by the DDL compiler into a
set of tables stored in the data dictionary,
* Storage structure and access method definition: writing a set of definitions translated by the data
storage and definition language compiler
* Scheme and physical organization modification: writing a set of definitions used by the DDL
compiler to generate modifications to appropriate internal system tables (e.g. data dis mnary). This
is done rarely, but sometimes the database scheme or physical organization must be modified.
* Granting of authorization for data access: granting different types of authorization for data
access to various users
* - Integrity constraint specification: generating integrity constraints. These are consulted by the
database manager module whenever updates occur.
1.8 DATABASE LANGUAGES
The following are the database languages used in DBMS:
DDL
Data Definition Language (DDL) statements are used to define the database structure or schema. Some
examples:
CREATE - to create objects in the database
ALTER - alters the structure of the database
DROP - delete objects from the database
TRUNCATE - remove all records from a table, including all spaces allocated for the records are
removed x
COMMENT - add comments to the data dictionary
RENAME - rename an object
© ‘SELECT - retrieve data from the a database
© INSERT - insert data into a table
© UPDATE - updates existing data within a table
Q DELETE - deletes all records from a table, the space for the records temain
O. MERGE - UPSERT operation (insert or update)
© CALL - call a PL/SQL or Java subprogram
© EXPLAIN PLAN - explain access path to data
O LOCK TABLE - control concurrency
Data Control Language (DCL) statements. Some examples:
O GRANT - gives user's access privileges to database
_ 9 REVOKE - withdraw access privileges given with the GRANT command
TCL
‘Transaction Control (TCL) statements are used to manage the changes made by DMListatements. It allows
‘statements to be grouped together into logical transactions.
~ © COMMIT - save work doneEE
to which you can later roll back
© SAVEPOINT - identify # point in a transaction
databe inal si Jast COMMIT
© ROLLBACK - restore database to original since the ee a
O SETTRANSACTION - Change transaction options like i
touse
one ection of related data, where data means recorded facts, ,
sa a re ate 11 world and is used for specific purposes by one or more
typical database represents some aspects of the rea i Bidding» comput
groups ofusers.A DBMS isa generalized software package for implementing ane crate Toa ib les
database, The database and software together form a database system: Tn a ai fe
that distinguish the database approach fom traditional file-processing APPHEM Oh fa tl he
tain categories of database users, or the “actors onthe scene.” We then presenta 8S © 071 ls that
should be provided by the DBMS software to the DBA, database designers, jen,
administer, and use a database.
1.10 SOLVED EXAMPLES
1. List four significant differences between a file-processing system and a D)
+ Some main differences between a database management system and a file-processing system are:
+ Both systems contain a collection of data and a set of programs which access that data, A database
management system coordinates both the physical and the logical access to the data, whereas a file.
processing system ccordinates only the physical access.
+ A databasemanagement system reduces the amount of data duplication by ensuring that a physical
piece of data is available to all programs authorized to have access to it,whereas data written by one
programin a file-processing system may not be readable by another program.
+ A database management system is designed to allow flexible access to data (i.e., queries), whereas ¢
file-processing system is designed to allow predetermined access to data (i.e., compiled programs)
+ A database management system is designed to coordinate multiple users accessing the same data at
the same time. A file-processing systemis usually designed to allow one or more programs to access
different data files atthe same time. In afile-processing system, a file can be accessed by two programs
concurrently only if both programs have read-only access to the file,
2. This chapter has described several advantages of a database system. What are two disadvantages?
Ans : Two disadvantages associated with database systems are listed below.
2 Setup ofthe database system requires more knowledge, money, skills, and time.
b. The complexity of the database may result in poor performance,
3. Explain the difference between physical and logical data independence,
Ans:
* Physical data independence isthe ability to modify the physical scheme without making it neces"
to rewrite application programs. Such modifications include changing from un-blocked to block
Tecord storage, or from sequential to random access files,
- Logical ‘data independence is the ability to modify
torewrite application programs. Such mace mae a scheme without making it necessary
Drogram’s view hides this change from the program, ‘adding afield to arecord; an application
BMS.om
ncept And Overview of DBMS
$$ Concept Ant overview of DBMS.
4. List five responsibilities of Database Manager system, For each responsibility, explain the problems
that would arise if the responsibility were not discha rged,
Ans : A general purpose database manager (DBM) has five responsibilities:
a interaction with the file manager,
b integrity enforcement,
¢. security enforcement,
4. backup and recovery.
©, concurrency control.
If these responsibilities were not met by a given DBM (and the text points out that sometimes a
responsibility is omitted by design, such as concurrency control ona single-user DBM for'a micro, computer)
the following problems can occur, respectively:
@. No DBM can do without this,
be retrieved,
if there is no file manager interaction then nothing stored in the files can
Consistency constraints may not be satisfied, account balances could go below the minimum allowed,
employees could eam too much overtime (e.g, hours > 80) or, airline pilots may fly more hours than
allowed by law.
©. Unauthorized users may access the database,
able to access parts of the database for whicl
could get access to national defense secret c
eam.
, d. Data could be lost permanently,
prior to a failure,
€. Consistency constraints may be violated.
example, incorrect bank balances might
and so on.
5. What are five main functions of a database administrator?
: Five main functions of a database administrator are:
+ To create the scheme definition
* To.define the storage structure and access methods
* To modify the scheme and/or physical organization when necessary
+ To grant authorization for data access
* To specify integrity constraints
orusers authorized to access part of the database may be
+h they lack authority. For example, a high school student
“odes, or employees could find out what their supervisors
rather than at least being available in a consistent state that existed
despite proper integrity enforcement in each transaction. For
be reflected due to simultaneous withdrawals and deposits,10
Database Managment System
4,11 MODEL QUESTIONS
Group - A (MCQ)
1. The data in the database at particular moment of times is called
a)schema b) snapshot
c)intension d)extension
+, Conceptual schema is transformed from high level data model into the implementation data model. This
step is called
a)data model mapping. b)conceptual schema
)functional mapping d)conceptual operation
the internal storage structures access paths and file organizations
. Ina phase of database design where
for the database files are specified. The phase is known as
a)logical design b)physical design
conceptual design d)functional operations
. DDL and DML statements are compiled and executed by
b) storage manager
d) data model
‘red in the database and the application programs provided by
=
a)query processor
) transaction manager
5. The interface between the low level data st
the
a)storage manager b)query processor
)data model d)transaction manager
Group - B
1. Why would you choose a database system instead of simply storing data in operating system files? When
would it make sense not to use a database system? 2003, 2009]
2003, 2004, 2009, 2010]
2, What is logical data independence and why is it important?
Explain the dierence between logical and physical data independence. 2003, 2005, 2008]
3.
4. Explain the dierence between extemal, internal, and conceptual schemas, How are these dierent schema
layers related to the concepts of logical and physical data independence?
5, What are the responsibilities ofa DBA? (2004, 2008]
Group -C
1, Discuss the main categories of data models.
els? How do
2. Describe the three-schema architecture. Why do we need mappings betweenschema le
different schema definition languages support this architecture? 2005, 2010]
Scrooge MeNugget wants to store information (names, addresses, descriptions of embarrassing moments,
3.
tte.) about the many ducks on his payroll. Not surprisingly, the volume of data compels him to buy @
database system, To save money, he wants to buy one with the fewest possible features, and he plans to
run itas a stand-alone application on his PC clone, Of course, Scrooge does not plan to share his list with
anyone. Indicate which of the following DBMS features Scrooge should pay for; in each case also indicate
why Scrooge should (or should not) pay for that feature in the system he buys.
1A security facility.
2. Concurrency control.
3. Crash recovery.= Concept And Overview of DBMS
4A view mechanism.
3. A query aaguage.
4. Which of the following plays an important role iit representing information about the real world in a
Sutabase? Explain brief.
1, The data denition language,
S. Describe the structure of a DBMS. If'your operating system is upgraded to support some gew functions
‘on OS files (@g., the ability to farce some sequence of bytes to disk), which layer(s) of the DBMS would
you bave to rewrite in onder to take advantage of these new functions?
1.12 WBUT SOLUTION
Multiple Choice Type Questions:
1, The set of permitted values for each attributes is called its [2006]
(@)anribute set (b) attribute range
©) domain (@) group
Aus. (c) domain.
2. A data model is 2 collection of conceptual tools for describing [2006
(@ data and data relationships
(®) data semantics and consistency contraints
(© data, data relationship, data semantics and consistency constraints
(@ none of these
‘Ams. (d) none of these.
3. The information about data in a database is called (2010)
(@) Meta data (b) Tera data
© Hyper data @) none of these.
‘Ans, (a) Meta data.
4. A top-to-bottom relationship among the items in a database is established by a
{2011}
(@) hierarchical schema (b) relational schema
(©) network schema @allof these
‘Ans :(a) hierarchical schema
5. Which is the false statement ? (17 601/2013)
(@)A database is ordered collection of data
(®) A database is systematic compilation of records in a computer
” (©) DBMS manages the database
(@) Data helps in making decisions.us Concept And Overview of DBMS
4, A view mechanism.
5. A query language.
4, Which of the following plays an important role in representing information about the real world in a
database? Explain briefly.
1. The data denition language,
2. The data manipulation language.
3, The buer manager.
4, The data model.
5. Describe the structure of a DBMS. If your operating system is upgraded to support some new functions
on OS files (e.g., the ability to force some sequence of bytes to disk), which layer(s) of the DBMS would
you have to rewrite in order to take advantage of these new functions?
1.12 WBUT SOLUTION
Multiple Choice Type Questions:
1, The set of permitted values for each attributes is called its [2006]
(a) attribute set (©) attribute range
(©) domain (@) group
‘Ans, (c) domain,
2. A data model is a collection of conceptual tools for describing {2006}
(@) data and data relationships
(b) data semantics and consistency contraints
(©) data, data relationship, data semantics and consistency constraints
(d) none of these
Ans. (4) none of these.
3. The information about data in a database is called {2010}
(@) Meta data (b) Tera data
(©) Hyper data @ none of these.
Ans. (a) Meta data.
4, A top-to-bottom relationship among the items in a database is established by a
(2011)
(@) hierarchical schema (b) relational schema
(©) network schema (d)all of these
Ans :(a) hierarchical schema
[17 601/2013}
5. Which is the false statement ?
(a) A database is ordered collection of data
(b) A database is systematic compilation of records in a computer
() DBMS manages the database
(4) Data helps in making decisions,
Ans. (b) A database is systematic compilation of records in a computerDatabase Managment System "2
Short & Long Answer Type Questions:
1. Why would you choose a database system inste:
perating system fijeyy
(2003, 2099)
er; these data’s will be stored iy
tored in a database server; thes
away to store and retrieve database informaig,
ad of simply storing data in 0
‘Ans.A database is a collection of interrelated data’s store¢
the form of tables. The primary aim of database is to provide
in fast and efficient manner. ;
‘ . in ita, te
‘There are many advantages of using database system instead of simply storing data in operating system
file.
(@ Controlling redundeney : Redundency meat
problems.
(@) Needs to perform a single logical update multiple times.
(b) Wastage of storage space for storing some data multiple times.
(©) File that represent the same data may become inconsistent.
Inthe database approach we can controi these types of redundency Pro!
base. :
(ii) Restricting unaulhorized access: Ina large database, all the users will not be authorized to access al
the information in the database. User or user groups are given a/e number and password by the DBA for
accessing the database. When DBA uses to create account, Then specily account restriction and retrive
unauthorized access.
i) Providing persistent storage for program objects : A
storage for program objects and data structure, The persistence storage of program objects and data structures
is an important function of DBMS. Traditional DBMS often suffered from the so-called impedance mismatch
problem. Since the data structures provided by the DBMS were incompatible with the data structure of
programming languages OODBMS affers data structure compatibility with one or more OOPS.
(iv) Providing storage structures for Efficient Query processing : DBMS must provide efficient excuting
of queries and updates because the data jis stored mainly on disk. DBMS also provide specilized data structures
to speed up disk search for any records. Indexes are used in this purpose.
(v) Providing backup and recovery : DBMS must provide facilities for recovering from hardware and
software failours. DBMS backup and recovery system back up all the data and if any transaction failed
before Commit point then it confirms that the database stored the previous data in the database.
(vi) Providing multiple usr interface : A Database management system can provide different types of wt
interface. These includes querey language for casual user, programing language interface for application
programmers forms and command code for parametric users and menu-driven interfaces and natural languages
interface for stand alone users.
(vii) Representing Complex relationship among data : Ina DBMS different types of data are interrelated
in many ways. A DBMS has the capability to represent a variety of complex relationshi ita tO
define new relationships and the retrieve related data esily, ae dppstioaiamane the da
(viii) Enforcing integrity constraints : A DBMS have certain integrity constraii th
ie la previ capabilities for defining aidlenficing tierce eee that must hold forthe
(ix) Permitting inferencing and Actions using Rules : Some DBI a ea
deduction rules for inferencing new information from the stored as ee capabilities for cis
deductive database system. In traditional DBMS an explicit ee - ts. a systems are ol
some operations where the operation is based on same brogram code is written to su
Procedual or specified set of rules such as trigger
ns storing the same data multiple times. This leads sever
blem by storing data once in dat
database can be used to provide persistent