0% found this document useful (0 votes)
11 views35 pages

Unit-1 Ch-1 Intro To DBMS New

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views35 pages

Unit-1 Ch-1 Intro To DBMS New

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

MAHARAJA SURAJMAL INSTITUTE

Department of Computer Applications

Database Management
System
(BCA-110)

1
Data & Information
• Data:-
Data are raw facts or figure that can be recorded and suitable for processing.
• Information:-
Information is the processed data on which decisions and actions are based. So information can be
defined as the organized and classified data to provide the meaning full values to the receiver.

Data Process Information

• Data Processing:-
It is the step by step refinement of data to get out desired information. OR Manipulating data through
operations like classification, sorting, merging, calculating and summarizing so as to provide the
desired output
• Characteristics of Information:-
i. Accuracy:- If it is value it should be accurate and if it is statement, it truly reflect the situation.
ii.Form:- The Information should be provided to user in the form so that that it should be useful and
best understood by him.
2
Data & Information
• Characteristics of Information:-
iii.Relevance:- It refers to the current utility of information in decision making or problem solving.
iv.Time lineless:- It means that information should be made available when it is needed for a particular
purpose with in minimum time.
v.Completeness:- Information should be complete. More completeness of the information more its
value.
vi.Purpose:- Information must have purpose at the time it is transmitted to a person, otherwise it is
simply a data.
vii.Reliability:- The information must be reliable.
viii.Validity:- It measure the closeness of the information to the purpose.

3
DBMS
Database
• Bit:- Bit represents 0 OR 1 i.e. smallest unit of data
• Byte:- A byte represents the collection of 8 bits & form a character that may
be alphabet, special character or digit.
Files/ Tables
• Field:- Logical grouping of bytes or character forms field.
• Record:- Logical grouping of related fields forms a record.
• File/ Table:- A file is a collection of logical records i.e. An associated group
Record of records is a file. Files may be of three types.
i. File containing text is called text file
ii. File containing program is a program file.
Field iii. File containing data is a data file.
• Database:- Logical grouping of Files/ Tables form database i.e. collection of
data.
Byte/ Char

Bit : 0 OR 1
4
DBMS Data Item / Field
• A simple example of database:- (ABC) Value
Data Item / Field Emp. Emp Basic
Name S.No DTOB Address
code Name Sal
1. E001 A 3/3/76 Delhi 60000
2. E002 B 4/5/76 Meerut 50000 File
3. E004 C 6/6/79 MSI 60000
Record 4. E005 D 9/5/80 MSIT 57000

• Data Item/ Filed Value:-


It is set of characters, used together for representing the value of particular data element.
• Data Item/ Filed name:-
The name give to each data item.
• Record:-
A record is the collection of related data eg record of any employee is (S.no, emp code,
emp name, DTOB, Address, Basic Sal).
5
Database
• Database:-
A data base is a collection of related data or information in the form of files so that it is available to
many users for different purpose. i.e. Database is a mechanism that is used to store data/information,
so that users should be able to store data in organized manner, so that it should easy to retrieve
information.
The content of the data base is obtained by combining data from all different sources in an
organization. So that data are available to all users and redundant data can be eliminated or at least
minimized. A data base can be of any size and varying complexity.
• Database System:-
A database system is basically a computerized record keeping system i.e. it is a computerized system
whose over all purpose is to maintain information and make available on demand. The data base
system has four major components:
i. Data:- Data are the facts or figure, which have some meaning, can be recorded and suitable for
processing.
ii. Hardware:- It consists of mainly two things:
a. Secondary Storage:- It consists of disks drums etc. on which data base reside magnetic disk
are also used for this purpose.
b. The hardware processor & associated main memory which are used to support the execution of
6
database system.
Database
• Database System:-
iii. Software:- It is the interface which act as a layer between the physical database and the users of
the system. It is also known as database management system (DBMS). All the request from
users are handed by DBMS.
iv. User:- Here we consider three different type of users:
a. Application programmer:- These users are responsible for writing application program
that uses database. The operation and control fun are also designed by the application
programmer by using comp. languages.
b. End users:- These are the users who interacts with the system from on line work stations or
terminals. These and users can access database from terminals.
c. Database administrator (DBA):- This is the user who is responsible to control the
database using existing function.

7
Components of Database
DBMS

Database (Hardware)
Application
Programs (Software) User1

User2

User3

8
DataBase Management System
• Data Base Management System:-
DBMS is a general purpose s/w system that acts as interface between the user of data and database.
This interface facilitates the process of Defining, Constructing and Maintaining data bases for
various applications. i.e. A DBMS is a collection of program that enables users to create and
maintain database.
➢ Defining database involves specifying the data types/structures and constraints for the data to be
stored in database.
➢ Constructing the database is the process of storing the data itself on some storage medium that
is controlled by the DBMS.
➢ Manipulating a database includes some functions such as retrieve specific data, updating data
and generating reports from the data.
SQL
User Request
DBMS Database
Information
User
➢ Database store information in computer readable form & DBMS is a set of programs that
enables storing, modifying and extracting information from a database. It also provide user to
add, delete, access, modify the data stored in database.
9
Application Areas of Database System

➢Airlines and Railways


➢Banking
➢Education sector
➢Telecommunication
➢E-Commerce
➢Health Care Information Systems
➢Digital Libraries and digital publishing
➢Finance
➢Sales
➢Human Resources
➢Weather Forecasting

10
FMS Vs DBMS
• File Management System:-
“In file management system data is stored in the form of files and a number of application programs
are written by programmer to add, modify, delete and retrieve data to and from appropriate file.
New application programs are written/ added as and when need arises. The operations like
insertion, deletion & updations can be done by application programmer.” FMS crashes when cross-
referencing & processing of information from different file is carried out.
This system has a number of disadvantages:-
i. Data Redundancy & Inconsistency:-
As the application programs are developed by different programmers, the same information can
be duplicated in several places i.e. Redundancy of data. The various copy of same data may no
longer agree. This may leads to data inconsistency.
ii. Data Isolation:-
As data are scattered in various files and may be in different formats. So it is very difficult to
write new application programs.
iii. Integrity Problems:-
As we apply certain consistency constraints on our database. Eg. As the balance of a bank
account may never fall below a prescribed amount (Rs. 500). To apply this constraint we write an
application program accordingly. When new constraint are added it is difficult to change program.
The problem become more complex when constraints involve several data items from different 11
files.
FMS Vs DBMS
• File Management System:-
iv. Atomicity problem:-
Consider a program to transfer Rs 500 from A/C A to A/C B. If the system failure occur during
the execution of the program. It is possible that Rs. 500 was removed from A/C A but was not
credited to A/C B resulting an inconsistent database. So the operation of funds transfer must be
atomic. It must happen completely or not at all.” It is difficult to ensure this property in a
conventional file management system.
v. Concurrent Access anomalies:-
Consider a bank account contain Rs. 1000 if 2 users withdraw funds (say Rs. 150 & Rs. 300)
from this account at about same time. The result may leave the account in an incorrect state. If
two programmers run concurrently and access the same data item and update it, then these
programs may leave the data base in incorrect state.
vi. Security problems:-
Every user of database system should not be allowed to access all the data. Each user should be
allowed to access the data concerning his area of application. But in FMS it is difficult to enforce
such security system.

12
FMS Vs DBMS
• Advantages of Database Management System:-
i. Minimum data redundancy:-
In data base system data of different users group are integrated during data base design into a single
logical, centralized structure. So by having a centralized data base and centralized control by DBA
the unnecessary duplication of data are avoided. So total data storage space also reduced. It also
eliminates the extra processing to trace the required data/information from large volume of data. Here
it is not necessary that all redundancy will be eliminated, but reduced up to maximum level.
ii.Inconsistency can be avoided:-
By using database inconsistency can be avoided up to some extent as the same information is
available at single place. So the only one place data is updated hence the inconsistency can be
avoided.
iii.Data can be shared:-
Here sharing means not only the existing application can share the data in database but also the new
application can be developed to operate against that same stored data.
iv.Data Independence:-
The separation of meta data from the application program that uses the data is called data
independence i.e. DBMS provide an abstract view and hides the detail, this is called data
independence, where detail of data are not exposed. So DBMS allow for change at one level of
database without affecting other level. These change are absorbed by mapping between the levels
13
FMS Vs DBMS
• Advantages of Database Management System:-
v. Improved data integrity:-
It means that data contained in the database is both accurate and consistent. Integrity usually
expressed in terms of constraints which are some rules that database should not violate. So
centralized control on data in database system ensures that checks are implemented in DBMS to
avoid such data integrity problem eg. Age of an employee can be between 18 & 70 years. So
while entering age database must check it.
vi. Standard can be enforced:-
With the central control on data base, the DBA can ensure that all applicable standard are
observed in the representation of data
vi. Improved backup & recovery services:-
DBMS provide a facility for recovering from hardware or software failure through its backup
and recovery sub system. If a computer fails in the middle of a program execution then recovery
subsystem is responsible to make sure that data is restored to the state as it was before execution
of program.
vii. Security restrictions can be applied:-
The DBA can ensure that access of database is through proper channel and hence can define
security rules to be checked whenever access is attempted to sensitive data

14
FMS Vs DBMS
• Advantages of Database Management System:-
viii. Compactness:-
No need for possibly large no. of paper files.
ix. Speed:-
The machine can retrieve and change dates faster than human can and can be answered quickly
then paper search file
x. Work without boring:-
Mechanical tasks are always done better by machine with out boring
xi. Accuracy:-
Accurate and up to date information is available on demand at any time
• Disadvantages of Database Management System:-
i. Complexity increases
ii. Requirement of more disk space
iii. Additional cost of hardware as well as software
iv. Need for backup and recovery
v. Organizational Conflicts may arise
vi. Require professionals to operate.
15
Database Architecture
• Database Architecture:-
As an organization requires an accurate and reliable data and efficient database system for effective
decision making. So one of the main aims of database system is to provide users with an abstract
view of data i.e. hiding certain details of how data is stored and manipulated. To satisfied these
needs, we need to develop the architecture for the database systems. “ The database architecture is a
frame work in which the structure of DBMS is described. The DBMS architecture describe how the
data is viewed by the user. It is not concern how the data is handled and processed by the DBMS”.
The database user are provided with an abstract view of the data by hiding certain details how the
data is physically stored. This enables the users to manipulate the data without worrying about where
it is located or how it is actually stored.
In the early days scientist proposed two kinds of database architecture, Two-tier architecture &
Three-tier architecture.
• Two-tier Architecture:-
The architecture was given in 1971 by Database Task Group (DBTG) which was appointed by
Conference on Data System and Languages(CODASYL), give a proposal for general architecture for
database system with two view, system view called schema & users view called subschema. In this
architecture application is partitioned into a component that reside at client machine, which evokes
database system functionality at server machine through query language statements. Application
program interfaces are used for interaction between the client and the server, as shown in fig.
16
Client/Server Architecture
• Two-tier Architecture:- • Three-tier/Level Architecture OR Three Level of Abstraction in
DBMS:-
As the main objective of database system
is to achieve data abstraction i.e. highlight
only essential features and hide the certain
details such as storage structure and data
organization etc from users. So again in
1975 ANSI – SPARC (American National
Standard Institute – Standard Planning
and Requirement Committee) produced a
three tier architecture. This architecture is
most popular and used now a days. Here
client machine acts as a front end and
does not contain any direct data base call,
but communicate with application server.
This application server in turn
communicates with data base system to
access data. As shown in fig.

17
Database Architecture
• Three-tier/Level/schema Architecture OR Three Level of Abstraction in DBMS:-
In this architecture overall database description can be defined at three levels namely, Internal Level,
Conceptual Level & External Level thus named as three-level architecture as shown in fig.
External/View
View 1 User1 View 2 User2 View 3 User3 View n User n
Level/Schema

External/Conceptual Mapping

Logical/Conceptual Conceptual Schema


Level/Schema
Conceptual/Internal Mapping

Internal Schema
Physical/Internal
Level/Schema

Physical Database
18
Database Architecture
• Three-tier/Level Architecture OR Three Level of Abstraction in DBMS:-
➢External Level:- It is the highest level of data abstraction. It is user’s view of database. It
describe only that part of data base which is concern to a particular application program for a
particular group of user. i.e. this level describe that part of database that is relevant to the user i.e.
user’s view and is also known as view level. Any number of users view even identical may exist,
different view may have different representation of different data eg. mm-dd-yy & yy-dd-mm. It
contains the method of getting the objects (eg. entities, attribute etc) in external view from the objects
in conceptual view and describe each external view.
i. It include only that portion of database or application program which is concern to a particular
user.
ii. It is described by means of schema called external schema or sub schema.
iii. It is defined by the user or written by application programmer.
➢ Conceptual Level:- It is middle level of abstraction. It describe what data are stored in the database
and what relationship exists among the data. At this level all the data base entities and relationship
among them are included. It contains the logical structure of entire database as seen by DBA and
also known as logical level. There is only one conceptual schema per database. Their schema also
contains the method of getting objects in conceptual view from objects in internal view. This level
concern with following activities.
19
Database Architecture
• Three-tier/Level Architecture OR Three Level of Abstraction in DBMS:-
➢ Conceptual Level:- This level concern with following activities.
i. All entities their attribute & their relationship.
ii. Constraints on data.
iii. Checks to retain data integrity & consistency.
iv. Security information.
v. It represents entire database.
➢ Internal Level:- It is the lowest level of abstraction. This level is the physical representation of the
database on the computer i.e. closed to physical storage method used i.e. concern the way in which
data is actually stored. This level indicate how the data will stored in database physically also
describe data structure, file structure and access method used by database. It describe the way the
DBMS & OS perceive the data in database. If also contains definition of the stored record & method
of representing the data field or attribute. Internal level is concern with following activities.
i. Storage space allocation for data
ii. Record description for storage
iii. Record placement
iv. Data compression & data encryption techniques

20
Database Architecture
• Three-tier/Level Architecture OR Three Level of Abstraction in DBMS:-
➢ Advantage of three-tier architecture :-
i. Each user is able to access same data but can have different customized view as per their own
need. Each user can change his or her view but this change will not affect other users of same
data.
ii. User is not concern about the physical data storage detail. i.e. the user’s interaction with the
database is independent of physical storage organization.
iii. Internal structure of database is unaffected by changes to physical storage such as change to new
storage devices.
iv. DBA is able to change database storage structure without affecting user’s view.
v. DBA is able to change the conceptual structure of database without affecting users.
➢ Level of Data Abstraction in Relational Model:-
Views Degree of Abstraction Focus on Independence/ Dependence
External High End User HW & SW independence

Conceptual Medium Complete view of Database HW & SW independence

Internal Low Storage & access method HW & SW dependence


21
Database Architecture
• Mapping:-
In three schema architecture, each user refers only to its own external schema so the user request
must be transformed into a request at conceptual schema them it should be transferred at internal
schema for final processing of data. The final result from processed data, as per user’s request must
be reformatted to satisfy user’s external view. This process of transforming requests and result
between three level is called mapping. In three level architecture two types of mapping exist.
i. Conceptual / Internal Mapping:-
Conceptual schema is related to internal schema through this mapping i.e. It define the
correspondence between conceptual & internal level (stored database). If enables the DBMS to
final actual record or combination of record in physical storage that makes logical record in
conceptual schema i.e. It specifies the methods of deriving the conceptual record from internal or
physical storage. In case of any change in the structure of the stored database, the
conceptual/internal mapping is also changed accordingly by the DBA, so that conceptual schema
remains invariant
ii. External / Conceptual Mapping:-
Each external schema is related to conceptual schema by this mapping. It defines the
correspondence between a particular external view and conceptual view. If also gives the
correspondence among the record and relationship of external & conceptual view. It enables the
DBMS to map names in the user’s view on to the relevant part of the conceptual schema.
. 22
Database Architecture
• Mapping:-
There could be one mapping between conceptual and internal levels and several mappings between
external and conceptual levels. The conceptual / internal mapping is the key to physical data
independence while external / conceptual is the key to logical data independence.
• Data Independence:-
It is the main advantage of three-schema architecture. “Data Independence is the characteristics
of a database system to change the schema at one level without effecting schema at other level”
i.e. Application program do not depend on any one particular physical representation or access
technique. It may also be defined as the immunity of application programs to change in physical
representation and access techniques. This characteristics of DBMS insulates the application program
from changes in the way the data is structured and stored. It is of two types:
i. Physical Data Independence:-
It indicate that physical storage structure or devices used for storing data (internal schema)
could be changed without change in conceptual or external view. The change would be
absorbed by conceptual/internal mapping. i.e. Immunity of conceptual or external schema to change
in the internal schema. Internal schema may be changed due to several reasons such as using
different file organization or storage structure, using different storage devices, creating additional
access structure.
23
Database Architecture
• Data Independence:-
ii. Logical Data Independence:-
It indicate that conceptual schema can be changed without affecting external schema or
application programs i.e. we can change conceptual schema without causing application
program to be rewritten. The change would be absorbed by external/conceptual mapping. i.e.
Immunity of external schema or application program to changes in conceptual schema. Conceptual
schema may be changed due to several reasons such as change in the constraints, addition or
deletion of new attributes, addition or deletion of attributes to or from the database.

24
Online Book Database

1) Book
(ISBN varchar (15),
Book_title varchar (40),
Category varchar (40),
Price int,
Copyright_date date,
Year year,
Page_count int);

2) Publisher
(P_ID varchar (6),
PName varchar (50),
Address varchar (50),
State varchar (20),
Phone varchar (20),
Email_ID varchar (30));

25
3. Author
(A_ID varchar (4),
AName varchar (30),
State varchar (20),
Phone varchar (20),
City varchar (15));

4. Review
(R_ID varchar (4),
ISBN varchar (15),
Rating int).

26
27
DBMS Facilities OR DBMS Languages
As DBMS support variety of users so it must provide appropriate language and interface for each
category of user to express database queries & updates. “A query is a statement or command to
interact with a database. The purpose of query is to retrieve information / data from database or to
insist or update data in database i.e. The language used to interact with database is called query
language SQL is well known standard language to interact with RDBMS. It can be following types :

i. Data Definition Language (DDL):-


It is used to define conceptual schema for the database and also gives some detail about how to
implement this schema in physical device used to store data. It include all entity set and their
associated attribute as well as relationship among entity set. DDL accepts the inputs in the form of
instructions/ statements and generate the description of schema as output. The output or the result
of compilation of DDL is set of table that is stored in a file/table called data dictionary, which
contain meta data.

28
• DBMS Facilities OR DBMS Languages:-
ii. Data Manipulation Language (DML):-
It enables the users to retrieve & manipulate the data. The over all goal is to provide efficient
human interaction with database system. It includes
➢ Retrieval of information from database.
➢ Add or insert new records into database.
➢ Deletion record/ information from database.
➢ Modification of information/data in database
It is of two types:
a. Procedural DML OR Low Level DML:- It require that a user specify what data is needed and
how to get it. Procedural DML retrieve a record, process it and retrieves another record based on
the result obtain by processing & so on. Eg. Relational algebra is procedural query language,
which consists of set of operations such as select, project, union etc.
b. Non Procedural DML OR High Level OR Declarative DML:- It require that a user specify what
data are needed without specifying how to get it. Eg. SQL.

* DBMS also provides two more languages, namely Data Control Language (DCL) and
Transaction Control Language (TCL)
29
Database Users
• Peoples who deals/ interact with database:-
Database users are those who interact with the database in order to query and update the database, and
generate reports. Database users are further classified into the following categories:
i. Naive Users:-
These are users who interact with system by application program that have been written. i.e. these
users query and update the database by invoking some already written application programs. Eg.
Reservation clerks at railways, hotels , agents, web users etc.
ii. Sophisticated Users:-
Such users interact with the system without writing programs. But they form their request by
writing queries in database query language. i.e. these users are familiar with the facilities provided
by a DBMS and interact with the system without any application program. Such users use
database query language to retrieve information from the database to meet their complicated
requirements. Eg. Business analyst, scientists etc.
iii. System Analysts:-
These users determine the requirement of database users especially for naïve users to create a
solution for their need and focus on non technical aspects (requirements & developing
specification for user interface)

30
Database Users
• Peoples who deals/ interact with database:-
iv. Application Programmers:-
These are computer professionals who implement the specifications given by the system analysts
and develop the application program and interact with the system through DML calls, which are
embedded in a program written in computer language such as C, C++, Java, VB etc. These
program are commonly referred as application program.
v. Database Administrator (DBA):-
The centralize control of both database and application programs accessing the database is alone
by a technical person or group of technical persons under the supervision of high level technical
administrator. This person is referred as DBA. DBA controls both data & program accessing data.
A DBA has following duties or responsibilities:
a. Schema Definition & Database Creation:- The overall structure of database is known as
database schema. It is the responsibility of DBA to create the database schema by writing a set
of data definition language that are translated by DDL complier into a set of tables. It include
the logical structure of database table. It include the logical structure of database table. DBA
also carries out the changes to the schema as per needs of the organization.
b. Storage Structure & Access Method:- A DBA decides how the data to be stored in database, this
process is called physical database design DBA defines storage structure i.e. internal schema of
database and access method of data from database.
c. Granting Authorization for Data Access:- It is one of the important responsibility of DBA. A
DBA grant access to use to database by giving different type of permission to different users 31
Database Users
• Peoples who deals/ interact with database:-
vi. Database Administrator (DBA):-
duties or responsibilities:
d. Physical Organization Modification:- DBA carries out the changes or modification to the
description of database or alter the physical organization to improve performance.
e. New Software Installation:- Its is the responsibility of DBA to install new DBMS software,
application software and other related software and test these new installed software.
f. Data Analysis:- DBA is responsible for analyzing the data stored in the database and studying
its performance & efficiency.
g. Routine Maintenance:- DBA maintain periodical back-ups of database to prevent the loss of
data. It also ensure that enough free space is available for normal operation. DBA also define
appropriate damage control mechanism also ensure that performance is not degraded by some
expensive task submitted by some user.

32
DBMS Structure

External view

Conceptual View

Internal view

33
Structure of Database System
➢ DML Compiler:-
As DML statements are embedded in application program. The DML compiler converts DML
statements such select …… into normal procedure calls in the host language. The compiler interacts
with the query processor to generate appropriate code.
➢ Query Processor:-
The query language processor is responsible for receiving query language statements and change
them from English like syntax to a form DBMS can understand. It usually consists of two parts:
i. Parser:- It receive query language statement from application program or from command line and
examine the syntax to ensure that they are correct. If statement follow the syntax rule, the token is
passed to query optimizer.
ii. Query Optimizer:- It also examine the query language statement and try to choose the best and
most efficient way of executing the query.
➢ DDL Compiler:-
DDL compiler convert the DDL statements such as CREATE TABLE….. into a set of tables
containing meta and stored in a data dictionary.
➢ File Manager:-
It manages allocation of disk space, data structure and internal schema used to represents information
on the disk.

34
Structure of Database System
➢ Database Manager:-
It is a program which provide interface between low level data, application program and queries
submitted to the system. It is responsible for interacting with file system. The goal of Dbase Manager
is to simplify and facilitate to access the data. It has following responsibilities:
i. Interaction with file manager:- The DBM translates various DML, statements into low level file
system commands or storing, retrieving and updating data in database.
ii. Integrity enforcement:- It is responsible for checking that certain updates in database should not
break any constraints, if so appropriate action may be imposed.
iii. Security enforcement:- It is done by ensuring that appropriate or authorized used can only access
data from database. It is the job of DBM to enforce these security requirements.
iv. Concurrency control:- When several users update database concurrently, the consistency may no
longer preserved. It is necessary for the system to control instruction among concurrent users and
achieving such a control is one of responsibilities of DBM.
v. Backup and recovery:- If some failure in database occur due to disk crash, power & s/w errors
then it is responsibility of DBM to restore the database to a state that prior to the occurrence of the
failure.

35

You might also like