Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 64

DATABASE MANAGEMENT SYSTEM

UNIT-I

Introduction

 Purpose of Database Systems


 View of Data
 Data Models
 Data Definition Language
 Data Manipulation Language
 Transaction Management
 Storage Management
 Database Administrator
 Database Users
 Overall System Structure

Database Management System (DBMS)

 Collection of interrelated data


 Set of programs to access the data
 DBMS contains information about a particular enterprise
 DBMS provides an environment that is both convenient and
Efficient to use.
 Database Applications:
 Banking: all transactions
 Airlines: reservations, schedules
 Universities: registration, grades
 Sales: customers, products, purchases
 Manufacturing: production, inventory, orders, supply chain
 Human resources: employee records, salaries, tax deductions
 Databases touch all aspects of our lives

Purpose of Database System

 In the early days, database applications were built on top of


file systems
 Drawbacks of using file systems to store data:
 Data redundancy and inconsistency
 Multiple file formats, duplication of information in different files
 Difficulty in accessing data
 Need to write a new program to carry out each new task
 Data isolation — multiple files and formats
 Integrity problems
 Integrity constraints (e.g. account balance > 0) become part of program code
 Hard to add new constraints or change existing ones
 Drawbacks of using file systems (cont.)
 Atomicity of updates
 Failures may leave database in an inconsistent state with partial
updates carried out
 E.g. transfer of funds from one account to another should either
 complete or not happen at all
 Concurrent access by multiple users
 Concurrent accessed needed for performance
 Uncontrolled concurrent accesses can lead to inconsistencies
 E.g. two people reading a balance and updating it at the same time
 Security problems
 Database systems offer solutions to all the above problems

Levels of Abstraction

 Physical level describes how a record (e.g., customer) is stored.


 Logical level: describes data stored in database, and the relationships among the data.
type customer = record
name : string;
street : string;
city : integer;
end;
 View level: application programs hide details of data types.
 Views can also hide information (e.g., salary) for security purposes.

View of Data

An architecture for a database system


Instances and Schemas

 Similar to types and variables in programming languages


 Schema – the logical structure of the database
e.g., the database consists of information about a set of customers and
 accounts and the relationship between them)
 Analogous to type information of a variable in a program
 Physical schema: database design at the physical level
 Logical schema: database design at the logical level
 Instance – the actual content of the database at a particular point in time
Analogous to the value of a variable
 Physical Data Independence – the ability to modify the physical schema
Without changing the logical schema
 Applications depend on the logical schema
 In general, the interfaces between the various levels and components should
be well defined so that changes in some parts do not seriously influence others.

Data Models

 A collection of tools for describing


 data
 data relationships
 data semantics
 data constraints
 Entity-Relationship model
 Relational model
 Other models:
o object-oriented model
o semi-structured data models
o Older models: network model and hierarchical model

Entity-Relationship Model

Example of schema in the entity-relationship model


Entity Relationship Model (Cont.)

 E-R model of real world


 Entities (objects)
 E.g. customers, accounts, bank branch
 Relationships between entities
 E.g. Account A-101 is held by customer Johnson
 Relationship set depositor associates customers with accounts
 Widely used for database design
 Database design in E-R model usually converted to design in the
relational model (coming up next) which is used for storage and
processing

Relational Model

 Example of tabular data in the relational model


A Sample Relational Database

Data Definition Language (DDL)

 Specification notation for defining the database schema


 E.g.
create table account (
account-number char(10),
balance integer)
 DDL compiler generates a set of tables stored in a data dictionary
 Data dictionary contains metadata (i.e., data about data)
 database schema
 Data storage and definition language
 language in which the storage structure and access methods used by the database system
are specified
 Usually an extension of the data definition language
Data Manipulation Language (DML)

 Language for accessing and manipulating the data organized by


the appropriate data model
 DML also known as query language
 Two classes of languages
 Procedural – user specifies what data is required and how to get
those data
 Nonprocedural – user specifies what data is required without
specifying how to get those data
 SQL is the most widely used query language

SQL

 SQL: widely used non-procedural language


 E.g. find the name of the customer with customer-id 192-83-7465
select customer.customer-name
from customer
where customer.customer-id = ‘192-83-7465’
 E.g. find the balances of all accounts held by the customer with customer-id 192-83-7465
select account.balance
from depositor, account
where depositor.customer-id = ‘192-83-7465’ and
depositor.account-number = account.account-number
 Application programs generally access databases through one of
 Language extensions to allow embedded SQL
 Application program interface (e.g. ODBC/JDBC) which allow SQL queries to be sent to a
database

Database Users

 Users are differentiated by the way they expect to interact with the system
 Application programmers – interact with system through DML calls
 Sophisticated users – form requests in a database query language
 Specialized users – write specialized database applications that do not fit into the
traditional data processing framework
 Naïve users – invoke one of the permanent application programs that have been written
previously
 E.g. people accessing database over the web, bank tellers, clerical staff

Database Administrator
 Coordinates all the activities of the database system; the database administrator has a
good understanding of the enterprise’s information resources and needs.
 Database administrator's duties include:
 Schema definition
 Storage structure and access method definition
 Schema and physical organization modification
 Granting user authority to access the database
 Specifying integrity constraints
 Acting as liaison with users
 Monitoring performance and responding to changes in requirements

Transaction Management

 A transaction is a collection of operations that performs a single logical function in a


database application
Transaction-management component ensures that the database remains in a consistent (correct)
state despite system failures (e.g., power failures and operating system crashes) and transaction
failures.
 Concurrency-control manager controls the interaction among the concurrent transactions,
to ensure the consistency of the database.

Storage Management

 Storage manager is a program module that provides the interface between the low-level
data stored in the database and the application programs and queries submitted to the
system.
 The storage manager is responsible to the following tasks:
 interaction with the file manager
 efficient storing, retrieving and updating of data

Overall System Structure


Application Architectures

_Two-tier architecture: E.g. client programs using ODBC/JDBC to communicate with a database
_Three-tier architecture: E.g. web-based applications, and applications built using “middleware”

FILE PROCESSING:

File is used to store the information (ie., permanent)

Eg: Bank Saving


---In that we have customer address,Account no,balance etc

These can be saved on a separate file.


Operations:

a) Credit/Debit
b) Checkout balance
c) Adding new A/C
d) Monthly processing

Disadvantages:
1.Data Redundancy :
Replication of data.(ie) Duplication of information
2.Data inconsistency:
We may not able to retrieve or store the data in proper manner

3.Integrity problem:
Constraints should be needed.(ie )the account must have at least Rs.100 etc.

4.Atomation:
Any H/W file has been occurred we must get the data.This cannot be made in
file processing.

5.Current access:
A multi-user cab access the data.Program should be able to change the
corrections at that time.

6.Security:
Freedom should not be given to all the person to use the program. It is not possible
for file processing.

 These drawbacks are overridden in DBMS.

DATABASE SYSTEM:

Computerized record keeping file. Its purpose to give the information on the demand
and also to store the information.

Database & DBMS:


Together to forms a database system.
Database:
Collection of related data.

Data:
It is a known fact which should have some implicit meaning.

DBMS:
It is a S/W, it may has some program in order to access the database.
Accessing:
Accessing has three meanings,
1. Defining
2. Constructing
3. Manipulating
---the database

1. Defining:
Trying to create a database. Types of data which is to be stored and if
the data have constraints in it, it should also check those constraints.

Eg: char Name(10)


Int RollNo(3)
Varchar Branch(7)

2. Constructing:
Storing the same database in a storage area.

3. Manipulating:
Querying the database and appending the database.

Things involved in the database system:

1. User:
It may be an end user –just hiding how the data is being stored, but the user can retrieve
the data’s.

2. Data
3. Software
4. Hardware

SIMPLIFIED PICTURE OF DATABASE SYSTEM:

Database system is embedded in single user or multi-user. Most probably in multi-user


system ie., more than one person can access the data .Two persons can act as a single user and
utilize the program.
Data:
Data can be integrated and data can be shared.

Data

Integrated Shared

Example databases:

1.Employee ---NAME DEPT SALARY


2.Enrollment ---NAME COURSES
Redundancy should be partially or fully eliminated in the case of integrated. Shared is nothing but
concurrent access. More than one user can use the same database.

HARDWARE:
Database is stored in secondary storage device using preprocessor or main memory
we access the database.

SOFTWARE:
A layer between the h/w and the user. Here DBMS can be done only using s/w/

USER:
There are different types of users.

User
Application User: It is a system programmer. He can access the database by means of
querying the database. He can query in any language.

Casual User: Database is accessed occasionally.

Native or parametric: He may access only a particular part of the database.

Sophisticated user: Able to use all part in the database. He knows all the part of the database.

Stand alone user: They create the database foe the personal use.

SIMPLIFIED DATABASE ENVIRONMENT:

AN EXAMPLE UNIVERSITY DATABASE THAT STORES STUDENTS RECORD AND


THEIR GRADES:

STUDENT NAME STUDENT NO CLASS MAJOR


SMITH 17 1 IT
BROWN 18 2 IT

COURSE NAME COURSE NO CREDIT HOUR DEPT


DISCRETE MATHS IT42 4 IT
DESIGN AND ANALYSIS IT45 4 IT
OF ALGORITHM
COMPUTER IT43 4 IT
ORGANIZATION AND
ARCHITECTURE
IT63 4 IT

MULTIMEDIA
ADVANCED DATABASE IT64 4 IT

SECTION COURSE NO SEMESTRE YEAR INSTRUCTOR


IDENTIFIER
85 MATH2410 FALL 98 KING
92 IT1310 FALL 98 ANDERSON
102 CS3320 SRING 99 KRUTA
112 MATH2410 FALL 99 CHANG

STUDENT NO SECTION IDENTIFIER GRADE


17 112 B
17 119 C
8 85 A

COURSE NO PREREQUESTIE NO
CS 3380 CS 3320
CS 3380 MATH2410

ADVANTAGES OF DBMS:

 Controlling redundancy
 Restricting unauthorized access
 Providing persistent storage for program objects and data structures
 Providing multiple user interfaces
 Representing complex relationship among data
 Enforcing integrity constraints
 Providing backup and recovery

DATABASE ENVIRONMENT:

VIEW OF DATA:
Data Abstraction:
Hiding the information how the has been stored in the database. The system
is said to be very successful when the retrieving of data is very efficiently. When this is done, in
data abstraction we are trying to make the system very successful using complex data structure
which represents data that stored in the database. The data can be abstracted for the user in
three ways. They are,

1.Physical Level(Internal)
2. Logical Level(conceptual)
3.External Level(View level)

1.Physical level:
First level in abstraction. The data stored in database will be in physical level.
The data are represented using complex structures

Fig: Interrelationship among the levels.

2.Logical Level:
What are the data stored in the database will be abstracted in logical level.
The data is represented using simple structures. It is the second level or intermediate level. The
interrelationship among the data may also be identified in logical levels.

3.External Level:

This is the third level. Different views are used for a single database. Only a
part of the data can be accessed.

Example:
In a Physical level for a given recursion a contiguous space will be allocated.

In a External level we trying to access what the data.

In a Logical level what are the field that allocated.

INSTANCES AND SCHEMA:

The database can be changed at the inclusion and deletion.The collection of database at the
moment can be defined as instances of data.

Overall design of the database is known as Schema.


Schema can be classified as,
1.Physical Schema
2.Logical Schema
3.Sub Schema

DATA INDEPENDENCE:
The data can be handled independently. There are 2 types:
1.Physical data independence:
When we modify in physical level, the application
program should not be rewritten. The modified program should be accessed by the same
application program.

2.Logical data independence:


When we modify in logical level, the application program
should not be rewritten.

ARCHITECTURE OF DATABASE:

A database management system that provides this three levels of data is said to follow
three levels of architectures. The 3 levels are:

1.External level
2.Conceptual level
3.Internal level

1.External level (or)Sub schema:

The external level is at the highest level of DB abstraction, where only those
portion of the DB of concerned to a user (or)application program are included.

Any no. of user views may exist for a given global or conceptual view. Each external view is
described by means of a schema called an external schema or subschema.

The external schema consists of definition of logical records & the relation ship in the
external view.

2.Conceptual level:
At this level of DB abstraction all the db entities and the relationship among
them are included.

One conceptual view represents the entire DB. This conceptual view is
\defined by the conceptual schema. It describes all the records and the relationships, included in
the conceptual view &therefore in the DB. There is only one conceptual schema per DB.

3.Internal level (or)physical schema:

We find this view at the lowest level of abstraction, closest to the physical
storage method used. It indicates hoe the data will be stored and described the data structure &
access methods to be used by the DB.

The internal view is expressed by the internal schema ,which contain the
definition of stored record ,the method of representing the data fields & the access aids used.
DBMS provides Data definition language and Data manipulation language.

Facilities provided by DBMS are,

1.Data Definition Facility (or)Data Definition Language(DDL)


2.Data Manipulation facility (or) Data Manipulation Language(DML)

Fig: The three levels of Architecture

1.DDL:
This can be used to define the conceptual schema and also give some details about how to
implement this schema in physical devices used to store data. The definition includes all the entity
set and their associated attributes as well as the relation among the entity sets. The compiled form
of definition is known as Data Dictionary, directory, system catalogue.

2.DML:
The language used to manipulate data in the database is called DML.This involves retrieval
of data the database and deletion or modification of existing data. The first of this data
manipulation operation is called a query. The subset of DML used to pose the query is known as
query language. The DML can be procedural.

Structure of DBMS:

The major components of DBMS are described below.

1.Data definition language compiler:

The DDL compiler converts the data definition statements into a set of tables.
This table contains the metadata concerning the database and are in a form that can be used by
other components of DBMS.

2.Data Manager:

The data manager is the central s/w component of DBMS. One of the
functions of the data manager is to convert the operations in the user queries coming directly via
the query processor or indirectly via an application programmer from the users logical view to a
physical file system. The data manager is responsible for interfacing the file system.
3.File manager:
Responsibility for the structure of the files and managing the file spaces rest
with the file manager. It is also responsible for locating the block containing the record, requesting
this block from the disc manager and transmitting the required record to the data manager.

4.Disc Manager:
Disc manager is part of the operation system of the host computer. All
physical input and output operations are performed by it. The disc manager transfers the blocks or
pages request by the file manager.

5.Query processor:
The database user retrieves the data by formulating the query in the data
manipulation language provided with the database. The query processor is used to interpret the
online users query and convert it into an efficient series of operation in a form capable of being
sent to the data manager for execution.

6.Data file:
The data file contains the data portion of the database.

7.Data Dictionary:
Information pertaining to the structure and usage of data contained in the
database, the metadata are maintained in the data dictionary. The data dictionary which is
database itself, documents the data. Each database user can consult the data dictionary to learn
what each piece of data and various synonyms of data file means.

DATA MODELLING:

Data base is used to store information. To represent the information some modeling is required.
Components in modeling will be according to interest of the object and also the relationship
among the objects.

They are of two types,


1. Object based logical model
2. Record based logical model

1. Object based logical model:

Object based logical model is further classified as


1. ER Model
2. Info logical model
3. Binary model
4. Semantic model
2.Record based logical model:

Record logical model is further classified as

1.Hierarchical model
2.Network model]
3.Relational model

1.Object based logical model:

It is a collection of conceptual tool(which is used to represent the data)for describing data,


data relation and data constraints.

2.Record based logical model:

Which describes the data structures and access techniques of DBMS.

ENTITY – RELATIONSHIP MODEL(ER Model):


The ER data model which is popular for high level database design, provides a means for
representing relationship[ between the entities.

ER model describes entity ,attributes and relationship.

Salient features of ER Diagram:

 This is used to give the structure of the data.


 Model can be evolved independent of any DBMS
 It is an aid for database design
 It is easy to visualize and understand

Sample entities ER-diagram is shown below,

Entity:
Basic thing in ER model. This entity represents the real world thing. Entity can be of any
type. Person is nothing but an entity to an ER diagram. It has different attributes. Attribute is
nothing but a property that describes an entity. Attributes can be of any type(physical,
commercial)Person entity may have attributes of his name,address,phoneno.Entity to Employee
attributes are Employee no, Employee name ,Salary,address,Department.

Attributes:
There are three types of attributes.
1.Simple Vs Composite attributes
2.Single value Vs Multivalued attribute
3.Null attribute
RELATIONSHIP:
An association among entities is called relationship.

Example: These exist a relation between students and courses.


This relationship represent a fact that a student enrolls foe a course and the course
as students. The shape of diamond inter-linking the relation.

Student Enrolls Course

TYPES OF RELATIONSHIP:

This will tell the relationship between two entities. There are three types of
relationships.1:n,n:1 and m:n

1)1:1:
The relationship between a department and manager is 1:1 .There is only one
manager per department and a manager manages only one department. The 1:1 is
shown below:

Manage Manager
Dept d by

2)1:Many :
The relationship between manager and Employee isone to many shown in the fig
below:

Employe Manage Manager


e r

3)Many: Many:
The relationship Between employee and say a project can be many to many. Each
employee could be employed in number of different projects and number of employee
could be involved in a projects as shown in fig:

Employee Works project


on
For Example: Company database design:

Administration
Marketing
Production
Accounts
--------------All these departments are supervised by a general manager.This general manager
have 1:n relationship among all the departments.

All the other ‘n’ person have relationship with only this single general manager.This is
nothing but n:1 relationship.

Suppose we have several projects and several programmes.This ‘m’ projects can have
relationship with is ‘n’ programmers. This is nothing but m:n relationship.

Notations in ER Diagram:

RECORD BASED LOGICAL MODEL:

(i)HIERARCHICAL:
The model evolved from file based system. In a hierarchical model the data is
organized in a hierarchical way (or)ordered in a tree structure and the database is a collection of
such disjoint trees. The model of the trees represent record type. Each tree effectively represents
a root record type and all of its dependents record type.

Fig: Representation of data in hierarchical model.

(ii)NETWORK :

Network data model uses two different data structures to represent the database
entities and relationship among entities ,namely record type & set type.

Record type is used to represent an entity type. It is made up of number of data items that
represent the attributes of the entities. A set type is used to represent a direct relationship
between two record types.

In this model the relation is the only construct required to represent the association
among the attributes of an entity as well as the relationship among different entities. The relation
may be visualized as a name table. Each column of the table corresponds to attribute of the
relation and its name, Rows of the relation are referred as tuple of the relation and column has it
attribute. The value for an
Database users:
1.Application programmer
2.Sophisticated users
3.Specialized users
4.Native users

1.Sophisticated users:
Going to access the data using query. Query will be converted into
sequences of operator through query processor.

2.Specilized:
Going to access a special type of data.Expert system ,information system are
accessed by the specialized user.

3.Antive user:
Unsophisticated user.There will be a permanent program,through that the data is
accessed.

Through application program we are going to access the data stored in the
database.

DBMS COMPONENTS:

The major components of DBMS are explained below.

1.DML pre compiler:


It converts DML statements embedded in an application program to normal
procedure calls in the host language. The pre compiler must interact with the query processor in
order to generate appropriate code.

2.DDL compiler:
The DDL compiler converts the data definition statements into set of tables. This
tables contain information converting the database and are in a form that cab be used by other
components of DBMS.

3.File Manager:
The file manager manages the allocation of location of space on desired storage and
the data structure used to represent in formation store on disk. The file manager can be
implemented using an interface to the existing file sub system provided by the operating system of
the host computer (Or) it can include a file of system written especially for DBMS.
4.Database Manager:
The data manager is the central software components of the DBMS.One of
the functions of the data manager is to convert operations in the users query coming directly via
the query processor (or) indirectly via application program from the users logical view to a
ph\7ysical file system.
In addition the task of enrolling constraints to maintain the consistency and
integrity of data ,as well as its security, are also performed by the data manager synchronizing the
simultaneous operation performed by current users is under the control of data manager.

5.Query Processor:
The data base users retrieves data by formulating a query. In the data manipulation
language provided with the DB.The Query processor is used to interpret the online users the
online users query and convert it into an efficient series of operations in a forum capable of being
sent to the data manager for execution. The Query processor uses the data dictionary to find the
structure of the relevant portion of the DB.

Data Files:
The data files contain the portion of the DB.

Data Dictionary:
Information pertaining to the student structure & usage of the data contained in the
database .The meta data are maintained in the data dictionary. The term system catalog also
distributes this meta data. The data dictionary which\h is data base itself documents the data,
each data base user can consult the data dictionary to learn what each piece of data.

Database Administrator(DBA):

Functions of DBA:

 Schema Definition
 Storage Structure & access method
 Modification in storage structure definition and physical organization
 Granting authorization for access of data
 Integrity constraints
 Communicate with the user
 Establishing standards & procedures

DBA:

Data base administrator is basically concerned with ensuring that accurate &
consistent information is available to users & application when needed and in the form required.
Thus DBA interacts with both the system & users.

The fig below shows the interaction between users and system.
One of the main reason for having the DBMS is to have control of both data &
program accessing the data .The person having such control over t he system is called the data
base administrator(DBA)

The DBA administrator the three levels of database and in consultation with
the overall user community sets up the definition of global view(or)conceptual level of the DB.

The DBA further specifies the external view of the various users and
application s & is responsible for the definition & in\implementation of the internal level including
the storage structure & access method s to be used for optimum performance of the DBMS.
Changes to any of the three levels are under the control of DBA. Mapping between the internal
and the conceptual level as well as between the conceptual & external level are also defined by
DBA.

Ensuring the appropriate measures are in place to maintain the integrity of the
DB and that DB is not accessible to unauthorized user is another responsibility. The DBA is also
responsible for defining procedure to recover the data base from failures due to human, natural,
(or)hardware causes with minimal loss of data. This recovery procedure should enable the
organization to continue to function and the intact portion of the data should continue to be
available.

FUNCTION OF DBA:

1)Schema Definition:

The creation of the original DB schema. This is accomplished by writing a set of


division which are translated by the DDL compiler to a set of tables that are permanently stored in
the data dictionary.

2) Storage Structures & access method definition:

The creation of appropriate storage structure & access method .This is


accomplished by writing a set of definition which are translated by the data storage and definition
language compiler.

3)Schema & physical organization modification:

Either the modification of the DB schema are the description of the physical storage
organization. The changes although relatively rate ,are accomplished by writing a set I\of
definitions which are used by either the DDL compiler or the data storage modifications to the
appropriate internal system tables .(For example ,the data dictionary)

4)Granting of authorization for data access:


Authorization for data access to the various users of the database. This allows DBA to
regulate ,which part of the database various users can access .The authorization information is
kept in a special system structure is consulted buy the database system whenever accessed to
data is attempted in the system.

5)Integrity constraint specification:

This constraints are kept in a special system structure (ie) that is consults by the DB
manager whenever one of the valuable tools that the DBA uses to carry out DBA in data
dictionary.

6)Communicating with user:


Databases often have 3 components.

a)Central, widely used DB containing much of the firms data.


b)Several functional DB ,used by limited set of programmers.
Eg: Accounting
c)Dedicated data bases-----used for a single application.
Eg: A Bill of material DB.

The important organization issue here is that the general impact of implementing a
DBS is the firms data. This centralizing data tends to eliminate the local owner ship of data and to
reduce redundancy. Ownership control are transferred to central data dictionary ,which maintain a
record of ownership and use of each data element. Such shifting of control over data may
generate some resistant from user. This resistant should be eliminated by activate educating the
users. The DBA provides this education to the users.

7)Establishing standards & procedures:

Their purpose is effective data abase requires establishment of standard &


procedures to maintain control of data integrity in an efficient way. Standards are particularly
applicable to controlling the development & use of database programming & operations.

DATA DICTIONARY:

It is seen that when a program become some what large in size, keeping a
track of all the available names that are used the purpose for which they were used becomes
more and more difficult. Of course it is possible for a programmer who has contained the available
names to bear them in mind, but should the same author. Come back to this program often a
significant time (or)should another programmer have try to modify the program. It would be found
that it is extremely difficult to make a reliable account for what purpose the data file was used.

The problem becomes even more difficult when the no. of data types that an organization
has in its data base increased.Therfore some kind of inventory and catalog of it must be
,maintained so as to assist in both the utilization and management of the resource.
It is for this purpose that a data dictionary are directory is emerging as a major tool and
inventory provides definition of things. A directory tells us where to find him.

A data dictionary contains information or data about the data. comprehensive data
dictionary would provide the definition of data item, how they fit into data structure how they relate
to other entities in the data base. With the base of information the data dictionary can serve
several useful purposes connecting across the whole spectrum off planning ,determining
information requirement, designing& implementation operation & revision.

There is now a greater emphasis on the data dictionary having an integrated system.

The DBA uses the data dictionary in every phase of database life cycle, starting from the
data gathering phase to the design, implementation maintenance phases. Documentation
provided by the end users & manages as it programmers .End user are nothing but sophisticated
users. Users can plan their application with the DB only if they know exactly what is stored in it.

For Example:

The description of data item in a data dictionary make includes its origin and other text
description in English ,in addition to its data format.

This users and managers will be able to see exactly what is available on the Database. We
could consider a data dictionary to be a road map which guides users to access information within
a large database.

An ideal data dictionary should include everything in a DB wants to know about the data
base.

1)External ,conceptual & internal database description.


2)Description of entities ,attributes as well as cross-references, origin & meaning of data
elements.
3) meanings, authorization and security codes.
4) Which external schema are used by which programs, who the users are and what their
Authorization are.

The data dictionary is implemented as a database so that user can query its content by
either interactive (or) batch processing .A data dictionary cam be a great assets not only to the
DBA for DB design, implementation & maintenance but also to managers to end users in their
project planning.

DATA BASE MANAGEMENT SYSTEM

UNIT –I

DEFINITION OF DBMS:
A data base management system (DBMS) consists of a collection of interrelated data’s and a set of program to access those
data. The collection of data, usually referred to us database, contains information about a particular enterprise. The primary goal
of a DBMS is to provide an environment that is both convenient and efficient in storing and retrieving data.
Database systems are designed to handle large volumes of informations.the management of data involves both the
definition of structure for storage and the provision of a mechanism for the manipulation of information. In addition the DBMS
must provide safety of information against system crashes and unauthorized access.

PURPOSE OF DATABASE SYSTEM:

Consider a part of saving bank enterprise that keeps information about all its customers and their account. One-way of keeping
this information on computer is to store them on a permanent system files. To allow users to manipulate these data various
application programs are written. Which includes:
 A program to debit or credit.
 A program to add a new account
 A program to find the balance of an account
 A program to generate monthly statements.

These application programs are written by different programmers and are stored in different files. New application
programs are added as and when the need arises. For example, a new government regulation may want checking of
accounts. As a result, new permanent files are created that contains all information about the checking of accounts in the
banks, and new application program may need to be written to deal with the situation that don’t arise in a saving bank
account such as overdraft.thus, as time goes by new application programs are added to the system.
This method was followed before the advent of DBMS.
Keeping organizational information in such file processing system has a number of disadvantages:

Disadvantages of using file processing system:

 DATA REDUNDANCY AND ENCAPSULATION:

Since different application programmers create the files and application programs over a long period, different
programs may be written in different languages and different files may have different format. More over the same
information may be duplicated in several places. For e.g. the telephone number and address of a customer may
appear in a file having saving account details and also in a file having checking account details. This redundancy
leads to higher storage and access cost. In addition it may lead to data inconsistency; that is various copies of same
data may no longer agree.

 DIFFICULTY IN ACCESSING THE DATA:

Suppose one of the bank officers needs to have a list of all the customers who live in the city having a particular
zip code. The officer asks the data processing dept to generate one such list. Since at the time of developing the
appln program this wasn’t anticipated the data processor has two options one is to either have an appln
programmer write a program to cater to this constraint or he has to manually do this job. If in case he asks the
programmer write a program and later if the officer demands to have a list of only those customers in that
particular city whose balance is greater than $10,000.as expected, the appln program to generate this does not exist
so again the data processor is left with the above two options both of then being inefficient. The basic idea is that a
file processing system does not allow the retrieval of data in a convenient and efficient manner.

 DATA ISOLATION:
Because data are scattered in different files and the files may be in different formats, its
difficult to write new programs to retrieve the appropriate data.

 INTEGRITY PROBLEM:
The data values stored in the database must satisfy certain constraints of consistency. For e.g. the balance of the
account may never fall below a certain amount. Developers enforce these constraints in the appln program
developed by including appropriate codes at various places. Therefore, if a new constraint is to be included then it
becomes very difficult to incorporate the change.

 ATOMICITY PROBLEM:

A computer system is subjected to failure. In many applications it’s crucial that once a failure has occurred
and detected the datas are retrieved to a consistent that existed prior to failure. Consider a program to transfer $50
from account A to account B. if a system failure occurs during transfer, its possible that amount $50 was removed
from account A but not credited to account B as a result data inconsistency occurs. That is the fund must be
automatic-it must happen in its entirely or not at all. It’s difficult to ensure this in a file processing system.

 CONCURRENT ACCESS ANAMOLIES:


So that overall performance of system increases and to allow faster access many systems allows multiple
users to use the system. In such an environment interaction of multiple users may result in data inconsistency .for a
e.g. If the balance of an account is $500 and two users are withdrawing an amount of $100 and $50 at the same
time then two different appln programs will be processing this simultaneously. Depending on which appl program
writes the data last in the balance account accordingly either $450 or $400 will be entered instead of $350. To
guard against this the system must maintain some form of supervision. This is not that easy in a file processing
system.

 SECURITY PROBLEM:

Not every user of the database must have access to all the datas. Since appln programs are added to system in an ad
hoc manner, its difficult to enforce such security problems.
These difficulties among others have promoted the development of DBMSs.

VIEW OF DATA
A DBMS is a collection of inters related files and a set of programs that allows users to access and modify these files. A
major purpose of database system is to provide users with an abstract view of the data.

DATA ABSTRACTION:
For the system to be usable it must ret rive data efficiently. This concern has led to the design of appropriate structures for the
representation of data in the database. Since not all users of database aren’t computer trained the developers hide the complexity
of the levels and provide easy levels of abstractions.

 PHYSICAL LEVEL: the lowest level of abstraction describes how the data are actually stored. At physical level,
the complex low-level data structures are described in detail.
 LOGICAL LEVEL: The next higher level of abstraction describes what kind of datas is stored in the database, and
what relationship exists among those datas. The entire database is thus represented in terms of small number of
relatively simple structures. Although the implementation of the simple structure at the logical level may involve
complex physical level structures. The logical level of abstraction is used by data administarators, who must
decide what information must be kept in the database.
 VIEW LEVEL:
The highest level of abstraction describes only a part of the database. Despite the use of simple structures at
logical level, some complexity remains, b’coz of large size of the database. Many users of the databases system will not be
connected all this information. Instead, such users need to access only a part of the database. So that their interaction with the
system is simplified, the view level of abstraction is defined. The system may provide many views of the same database.
VIEW 1 VIEW 2 ………. VIEW N

VIEW LEVEL

LOGICAL LEVEL

PHYSICAL LEVEL
INSTANCES AND SCHEMAS:

Databases change over time as information are added and deleted. The collection of information stored in the database in a
particular moment is called instances. The overall design of the database is called database schema. Schema are changed
infrequently if at all,

A database schema corresponds to the programming language type definition. A variable of a given type has a particular
value at a given instant. Thus the value of variable in programming language corresponds to the instance of the database schema.
Data base systems have several schemas, partitioned according to the level of abstraction. At the lowest level is the physical
schema; at the intermediate level is the logical schema; and at the highest level is the subschema. In general a database system
supports a physical schema, a logical schema, a subschema.

DATA INDEPENDENCE:

The ability to modify a data schema at one level with out modifying the data schema at another level is called data
independence. There are two levels of data independence:

1. PHYSICAL DATA INDEPENDENCE: is the ability to modify the physical schema without causing the application
program to rewritten. Modification at this level is needed to improve performance.
2. LOGICAL DATA INDEPENDECE: is the ability to modify the logical level schema without causing the application
program to be rewritten. Modification at this level is needed to alter the logical structure of database.

Logical data independence is more difficult to achieve then physical data independence. Since appln programs are heavily
dependent on the logical structure of the database.
DATA MODELS:

Underlying the concept of database is data models: a collection of conceptual tools for describing data, data relationship, data
sematics, and consistency constraints. The various data models are: object based logical models, record based logical model,
physical model.

OBJECT –BASED LOGICAL MODEL:


Object –based logical model is used to describe datas at logical and view level. They are characterized by the fact that they
provide fairly flexible structuring capabilities and allows data constraints to be specified explicitly. There are many different
models. Some of them are:
 THE ENTITY RELATIONSHIP MODEL.
 THE OBJECT ORIENTED MODEL.
 THE SEMATIC DATA MODEL.
 THE FUNCTIONAL DATA MODEL

THE ENTITY RELATIONSHIP MODEL:


The entity relationship (E-R) model is based on the perception of a real world that consist of a number of basic objects, called
entities, and of relationships among these objects. An entity is a ‘thing’ or ‘object’ in a real world that is distinguishable from
other objects. For e.g. every person is an entity and bank account is considered to be entities. Entities are described in database by
a set of attributes. For e.g. the attribute balance and account no describes one particular account in the bank. A relationship is an
association among several entities. For e.g. a depositor associates a customer with each account no that they have. The set of all
entities of same type and set of all relationship of same type are termed as entity set and relation set.
In addition to entities and relationship, a E-R model represents certain constraints to which the contents of the database must
conform to. One important thing is mapping cardinalities, which gives the no of entities to which a given entity is related. The
overall graphical structure of an E-R model is represented as follows:

Customer street account number balance

CUSTOMER Account
Samples E-R diagram.

 Rectangle represents entity


 Ellipse represents attributes
 Diamonds represents relationship among entity sets
 Lines links the attributes to entity sets and entity sets to relationships

Each component is labeled with entity or relationship, which it represents.

OBJECT ORIENTED MODEL:


Like the E-R model the object oriented model is based on collection of objects. An object contains values stored in instance
variable within the object. An object also contains bodies of codes that operate on that object. These bodies of codes are called
methods.
Object that contains the same type of values and same methods are grouped together as classes. A class may be viewed ad a
type definition of objects.
The only way by which one object can access the variable of another object is by the methods of that object. This action is
called sending a message to that object. Thus, the call interface of a method of an object defines that objects externally visible
parts. The internal part of the object – the instance variable and the method code isn’t visible externally. The result is two levels of
data abstraction.
Unlike the entities in E-R model each object had its unique identity, independent of the values it contains. Thus, two objects
containing the same object are nevertheless distinct. The distinction among individual objects is maintained in the physical level
thro’ the assignment of distinct object identifiers.

RECORD BASED LOGICAL MODEL:


Record based logical model describes the data at logical and view level. In contrast to object-based model, they are used both to
specify the overall logical structure and also to provide higher-level description of the implementation.
Record based data model is so named as the data are organized in the form of records of fixed format. Each record type
describes a fixed number of fields, or attributes, and each field is usually of fixed length. The 3 most widely accepted models are:
relational n/w, hierarchical models.
RELATIONAL MODEL:
The relational model uses a collection of represent both data and their relationships among those datas. Each table has multiple
columns, and each column has unique name. The e.g. given below shows a sample relational model comprising of 2 tables: one
shows the bank customers, and other there corresponding accounts.
Customer- Social Customer Customer city Account
Johnsonname
192-83-7465 Alma
security street Palo alto A-101 number
Smith 019-28-3746 North Rye A-215
Hayes 677-89-9011 Main Harrison A-102
Turner 182-73-6091 Putnam Stamford A-305
Johnson 192-83-7465 Alma Palo alto A-201
Jones 321-12-3123 Main Harrison A-217
Lindsay 336-66-9999 Park Pitts field A-222
Smith 019-28-3746 North Rye A-201

ACCOUNT NUMBER BALANCE

A-101 500
A-215 700
A-102 400
A305 350
A-201 900
A-217 750
A-222 700

A SAMPLE RELATIONAL DATABASE.


NETWORK MODEL:
Data in n/w model is represented by collections of records and relationship among datas is represented by links, which can be
viewed as pointer. The records in it are organized as an arbitrary graph.

Johnson 192-83-7465 Alma Palo A-101 500


alto

Smith 019-28-3746 North

A-215 700

Hayes 677-89-9011 Main A-102 400

Turner 182-73-6091 Putnam A-305 350

A-201 900
Jones 321-12-3123 Main

A-217 750

Lindsay 336-66-999 Park A-222 700

A SAMPLE NETWORK DATABASE.


PHYSICAL DATA MODEL:
Physical data model are used to describe datas at lower level .in contrast to logical model. There are a few physical data models
in use. Two of them are unifying model, frame memory model.

johnson 192-83- ……..


7465

smith 019-28- …….


3746

Hayes 677-89- …….


9011

A- 500 A- 900 Turner 182-73- ….


101 201 6091

Jones 321-12- …..


3123

A- 700 A-201 Lindsay 336-66- …….


215 900 9999
A305
350
A102 400 A- 750 A- 700
217 222

A SAMPLE HIERARCHIA L DATABASE.

TRANSACTION MANAGEMENT:
Often, several operations on a database form a single logical unit of work. An e.g. that we have seen before is a fund transfer, in
which account is credited and another account is debited. Clearly its essential that either both the credit or debit occur or neither
occur. This all or none property is called atomicity. In addition it’s necessary that the fund transfer must preserve the consistency
of database. That’s the value of sum A+B must be preserved. This correctness measure is called consistency.
A transaction is a collection of operations that perform single logical function in a database. The transaction process must
obey the database consistency factors mentioned above. However during a transaction, inconsistency may be allowed temporarily.
This temporary inconsistency tho’ necessary may lead to difficulties if failure occurs.
Hence, it’s essential to specify only those transactions, which preserve the consistency of database. Ensuring the durability and
atomicity property is the responsibility of the database itself- specifically of the transaction management component.

DATA BASE ADMINISTRATOR:


One of the main purposes of using DBMS is to have central control of the database. The person who performs this is called
DATA BASE ADMINISTRATOR. The functions of DBA are:
 SCHEMA DEFINITION: the DBA creates the original schema by writing a set of definitions, which transform the DDL
compiler to a set of tables that is stored permanently in the data dictionary.
 STORAGE STRUCTURE AND ACCESS METHOD DEFINTION: the DBA creates appropriate storage structures and
access methods by writing a set of definitions, which translates by the data storage and data definition language.
 SCHEMA AND PHYSIACL ORGANISATION MODIFICATION: programmers accomplish the relatively rare
modification either to database schema or to the description of the physical storage organization by writing a set of
definitions that’s used either by the DDL compilers or by data storage and data definition language compile language
compiler to generate modifications to the appropriate internal system table.
 GRANTING OF AUTHORIZATION FOR DATA ACCESS: the granting of different types of authorization allows the
DBA to regulate which part of database various users can access. The authorization information are stored in a special
storage device and consulted whenever access is demanded.
 INTEGRITY CONSTRAINT SPECIFICATION: the data values stored in database constraint must satisfy certain
integrity constraints. Such constraints must be specifies explicitly by the DBA. The integrity constraints are kept in
special storage structure that is consulted by the database system whenever an update takes place in the system.

OVER ALL SYSTEM STRUCTURE:


A database system is portioned into modules that deal with each of the responsibility that the system must perform. The OS
may provide some of the functions of the database. The OS provides only the basic functions. Thus the design of database must
provide interfacing between the database and the OS.
The functional components of database system can be divided into query processor component and storage manager component.
The query processor component includes:
 DML COMPILER: which translates DML statements in a query language into low-level instruction that the query
evaluation engine understands. In addition, the DML compiler attempts to user’s request into equivalent but more
efficient form, thus providing a good strategy for execution.
 EMBEDDED DML COMPILERS: which converts DML statements in embedded app. prog to normal procedural calls
in the host language. The precompiled must interface with DML compiler to generate the app. Code.
 DDL INTERPRETER: it interprets DDL statements and records them in a set of tables called Meta tables.
 QEURY EVALUATION ENGINE: it executes low-level instructions generated by the DML compiler.

Storage manager component provides interface between low-level data stored in database and the app. progs and queries
submitted to the system. Storage manager component includes:
 AUTHORIZATION AND INTEGRITY MANAGER: it tests for the satisfaction of integrity constraints and checks for
authorized access.
 TRANSACTION MANAGER: it ensures that the database remains in consistency, despite failures.
 FILE MANAGER: it manages the allocation of space on disk storage and the data structures used to represent
information stored in disk.
 BUFFER MANAGER: it’s responsible for fetching data from disk storage into main memory, and deciding what data to
cache in memory.

 DATA FILES: stores the database itself.


 DATA DICTIONARY: Stores data about data.
 INDICES: provides fast access to data item that holds particular item.
 STATISTICAL DATA: stores statistical information about the data’s stored in the database.

Naïve users app. Programmers sophisticated users database administrator


(Tellers, agents)

Users

Application Application Query Database schemes


Interfaces Programs

Embedded DML
recompiles DML DDL interpreters
compilers

Application
programs
object code

Query
evaluation
engine

Buffer
manager

File manager

Transaction
manager

Indices
Disk storage

Statistical data

Data files

Data dictionary

DATABASE MANAGEMENT SYSTEM


UNIT-I

Introduction :

 Purpose of Database Systems


 View of Data
 Data Models
 Data Definition Language
 Data Manipulation Language
 Transaction Management
 Storage Management
 Database Administrator
 Database Users
 Overall System Structure

Database Management System (DBMS)

 Collection of interrelated data


 Set of programs to access the data
 DBMS contains information about a particular enterprise
 DBMS provides an environment that is both convenient and
efficient to use.

Database Applications:

1. Banking: all transactions


2. Airlines: reservations, schedules
3. Universities: registration, grades
4. Sales: customers, products, purchases
5. Manufacturing: production, inventory, orders, supply chain
6. Human resources: employee records, salaries, tax deductions
7. Databases touch all aspects of our lives
Purpose of Database System :

 In the early days, database applications were built on top of


file systems
 Drawbacks of using file systems to store data:
 Data redundancy and inconsistency . Multiple file formats, duplication of
information in different files
 Difficulty in accessing data . Need to write a new program to carry out each
new task
 Data isolation — multiple files and formats
 Integrity problems . Integrity constraints (e.g. account balance > 0) become
part of program code . Hard to add new constraints or change existing ones

 Drawbacks of using file systems (cont.)

 Atomicity of updates . Failures may leave database in an inconsistent state


with partial updates carried out . E.g. transfer of funds from one account to
another should either complete or not happen at all
 Concurrent access by multiple users . Concurrent accessed needed for
performance . Uncontrolled concurrent accesses can lead to inconsistencies
E.g. two people reading a balance and updating it at the same time
 Security problems
 Database systems offer solutions to all the above problems

Levels of Abstraction

Physical level :describes how a record (e.g., customer) is stored.


Logical level: describes data stored in database, and the relationships among the
data.
type customer = record
name : string;
street : string;
city : integer;
end;
View level: application programs hide details of data types.
Views can also hide information (e.g., salary) for security purposes.
View of Data

An architecture for a database system

Instances and Schemas

 Similar to types and variables in programming languages


 Schema – the logical structure of the database
e.g., the database consists of information about a set of customers and
accounts and the relationship between them)
 Analogous to type information of a variable in a program
 Physical schema: database design at the physical level
 Logical schema: database design at the logical level
 Instance – the actual content of the database at a particular point in time
Analogous to the value of a variable
 Physical Data Independence – the ability to modify the physical schema
without changing the logical schema
 Applications depend on the logical schema
 In general, the interfaces between the various levels and components should
be well defined so that changes in some parts do not seriously influence
others.
Data Models

 A collection of tools for describing data


 data relationships
 data semantics
 data constraints
 Entity-Relationship model
 Relational model
 Other models:
 object-oriented model
 semi-structured data models
 Older models: network model and hierarchical model

Entity-Relationship Model

Example of schema in the entity-relationship model

 E-R model of real world


 Entities (objects) . E.g. customers, accounts, bank branch
 Relationships between entities . E.g. Account A-101 is held by customer Johnson
 Relationship set depositor associates customers with accounts Widely used for database
design
 Database design in E-R model usually converted to design in the relational model (coming
up next) which is used for storage and processing
Relational Model :

Example of tabular data in the relational model

A Sample Relational Database


Data Definition Language (DDL) :

 Specification notation for defining the database schema


E.g.

create table account (


account-number char(10),
balance integer)
 DDL compiler generates a set of tables stored in a data dictionary
 Data dictionary contains metadata (i.e., data about data)
 database schema
 Data storage and definition language . language in which the storage structure and access
methods used by the database system are specified . Usually an extension of the data
definition language

Data Manipulation Language (DML)

_ Language for accessing and manipulating the data organized by


the appropriate data model
_ DML also known as query language
_ Two classes of languages
_ Procedural – user specifies what data is required and how to get
those data
_ Nonprocedural – user specifies what data is required without
specifying how to get those data
_ SQL is the most widely used query language

SQL
_ SQL: widely used non-procedural language
_ E.g. find the name of the customer with customer-id 192-83-7465
select customer.customer-name
from customer
where customer.customer-id = ‘192-83-7465’
_ E.g. find the balances of all accounts held by the customer with customer-id 192-83-7465
select account.balance
from depositor, account
where depositor.customer-id = ‘192-83-7465’ and
depositor.account-number = account.account-number
_ Application programs generally access databases through one of
_ Language extensions to allow embedded SQL
_ Application program interface (e.g. ODBC/JDBC) which allow SQL queries to be sent to a
database

Database Users
_ Users are differentiated by the way they expect to interact with the system
_ Application programmers – interact with system through DML calls
_ Sophisticated users – form requests in a database query language
_ Specialized users – write specialized database applications that do not fit into the traditional data
processing framework
_ Naïve users – invoke one of the permanent application programs that have been written
previously
_ E.g. people accessing database over the web, bank tellers, clerical staff

Database Administrator

_ Coordinates all the activities of the database system; the database administrator has a good
understanding of the enterprise’s information resources and needs.
_ Database administrator's duties include:
_ Schema definition
_ Storage structure and access method definition
_ Schema and physical organization modification
_ Granting user authority to access the database
_ Specifying integrity constraints
_ Acting as liaison with users
_ Monitoring performance and responding to changes in requirements

Transaction Management
_ A transaction is a collection of operations that performs a single logical function in a database
application
_ Transaction-management component ensures that the database remains in a consistent
(correct) state despite system failures (e.g., power failures and operating system crashes) and
transaction failures.
_ Concurrency-control manager controls the interaction among the concurrent transactions, to
ensure the consistency of the database.

Storage Management

_ Storage manager is a program module that provides the interface between the low-level data
stored in the database and the application programs and queries submitted to the system.
_ The storage manager is responsible to the following tasks:
_ interaction with the file manager
_ efficient storing, retrieving and updating of data

Overall System Structure

Application Architectures

_Two-tier architecture: E.g. client programs using ODBC/JDBC to communicate with a database
_Three-tier architecture: E.g. web-based applications, and applications built using “middleware”
FILE PROCESSING:

File is used to store the information (ie., permanent)

Eg: Bank Saving


---In that we have customer address,Account no,balance etc

These can be saved on a separate file.


Operations:

e) Credit/Debit
f) Checkout balance
g) Adding new A/C
h) Monthly processing

Disadvantages:
1.Data Redundancy :
Replication of data.(ie) Duplication of information
2.Data inconsistency:
We may not able to retrieve or store the data in proper manner

3.Integrity problem:
Constraints should be needed.(ie )the account must have at least Rs.100
etc.

4.Atomation:
Any H/W file has been occurred we must get the data.This cannot be
made in file processing.
5.Current access:
A multi-user cab access the data.Program should be able to change the
corrections at that time.

6.Security:
Freedom should not be given to all the person to use the program. It is not
possible for file processing.

-- These drawbacks are overridden in DBMS.

DATABASE SYSTEM:

Computerized record keeping file. Its purpose to give the information on the
demand and also to store the information.

Database & DBMS:


Together to forms a database system.

Database:
Collection of related data.

Data:
It is a known fact which should have some implicit meaning.

DBMS:
It is a S/W ,it may has some program in order to access the database.
Accessing:
Accessing have three meanings,
4. Defining
5. Constructing
6. Manipulating
---the database

1.Defining:
Trying to create a database. Types of data which is to be stored and
if the data have constraints in it ,it should also check those constraints.

Eg: char Name(10)


Int RollNo(3)
Varchar Branch(7)

2. Constructing:
Storing the same database in a storage area.

3.Manipulating:
Querying the database and appending the database.

Things involved in the database system:

1.User:

It may be an end user –just hiding how the data is being stored ,but the user can
retrieve the datas.

2.Data
3.Software
4.Hardware
SIMPLIFIED PICTURE OF DATABASE SYSTEM:

Database system is embedded in single user or multiuser.Most probably in multi-user system


ie., more than one person can access the data .Two persons can act as a single user and
utilize the program.

Data:
Data can be integrated and data can be shared.

Data

Integrated Shared

Example databases:

1.Employee ---NAME DEPT SALARY


2.Enrollment ---NAME COURSES

Redundancy should be partially or fully eliminated in the case of integrated.

Shared is nothing but concurrent access.More than one user can use the same database.

HARDWARE:
Database is stored in secondary storage device using preprocessor or main
memory we access the database.

SOFTWARE:
A layer between the h/w and the user.Here DBMS can be done only using s/w/
USER:
There are different types of users.

User

Application User: It is a system programmer. He can access the database by means of


querying the database.He can query in any language.

Casual User: Database is accessed occasionally.

Native or parametric: He may access only a particular part of the database.

Sophisticated user: Able to use all part in the database.He knows all the part of the database.

Stand alone user: They create the database foe the personal use.
SIMPLIFIED DATABASEW ENVIRONMENT:

AN EXAMPLE UNIVERSITY DATABASE THAT STORES STUDENTS RECORD AND


THEIR GRADES:

STUDENT NAME STUDENT NO CLASS MAJOR


SMITH 17 1 IT
BROWN 18 2 IT

COURSE NAME COURSE NO CREDIT HOUR DEPT


DISCRETE MATHS IT42 4 IT
DESIGN AND IT45 4 IT
ANALYSIS OF
ALGORITHM
COMPUTER IT43 4 IT
ORGANIZATION AND
ARCHITECTURE
IT63 4 IT

MULTIMEDIA
ADVANCED IT64 4 IT
DATABASE

SECTION COURSE NO SEMESTRE YEAR INSTRUCTOR


IDENTIFIER
85 MATH2410 FALL 98 KING
92 IT1310 FALL 98 ANDERSON
102 CS3320 SRING 99 KRUTA
112 MATH2410 FALL 99 CHANG

STUDENT NO SECTION IDENTIFIER GRADE


17 112 B
17 119 C
8 85 A

COURSE NO PREREQUESTIE NO
CS 3380 CS 3320
CS 3380 MATH2410

ADVANTAGES OF DBMS:

 Controlling redundancy
 Restricting unauthorized access
 Providing persistent storage for program objects and data structures
 Providing multiple user interfaces
 Representing complex relationship among data
 Enforcing integrity constraints
 Providing backup and recovery

DATABASE ENVIRONMENT:
VIEW OF DATA:
Data Abstraction:
Hiding the information how the has been stored in the database.The
system is said to be very successful when the retrieving of data is very effieciently.When this
is done,in data abstraction we are trying tro make the system very successful using complex
data structure which represents data that stored in the database.The data can be abstracted
for the user in three ways.They are,

1.Physical Level(Internal)
2. Logical Level(conceptual)
3.External Level(View level)

1.Physical level:
First level in abstraction.The data stored in database will be in physical
level.The datas are represented using complex structures
Fig: Interrelationship among the levels.

2.Logical Level:
What are the data stored in the database will be abstracted in logical
level.The data is represented using simple structures.It is the second level or intermediate
level.The interrelationship among the datas may also be identified in logical levels.

3.External Level:

This is the third level.Different views are used for a single database.Only
a part of the data can be accessed.

Example:
In a Physical level for a given recursion a contiguous space will be allocated.

In a External level we trying to access what the datas

In a Logical level what are the field that allocated.

INSTANCES AND SCHEMA:

The database can be changed at the inclusion and deletion.


The collection of database at the moment can be defined as instances of data.

Overall design of the database is known as Schema.


Schema can be classified as,
1.Physical Schma
2.Logical Schema
3.Sub Schema

DATA INDEPENDENCE:
The data can be handled independently.There are 2 types:
1.Physical data independence:
When we modify in physical level,the application
program should not be rewritten. The modified program should be accessed by the same
application program.

2.Logical data independence:


When we modify in logical level,the application
program should not be rewritten.

ARCHITECTURE OF DATABASE:

A database management system that provides this three levels of data is said to follow three
levels of architectures.The 3 levels are:

1.External level
2.Conceptual level
3.Internal level

1.External level (or)Sub schema:

The external level is at the highest level of DB abstraction, where only


those portion of the DB of concerned to a user (or)application program are included.

Any no. of user views may exist for a given global or conceptual view.Each external
view is described by means of a schema called an external schema or subschema.

The external schema consists of definition of logical records & the relation ship
in the external view.

2.Conceptual level:
At this level of DB abstraction all th db entities and the relationship
among them are included.

One conceptual view represents the entire DB.This conceptual view is


\defined by the conceptual schema.It describes all the records and the relationships, included
in the conceptual view &therefore in the DB.There is only one conceptual schema per DB.

3.Internal level (or)physical schema:

We find this view at the lowest level of abstraction,closest to the physical


storage method used.It indicates hoe the data will be stored and described the data structure
& access methods to be used by the DB.

The internal view is expressed by the internal schema ,which contain the
definition of stored record ,the method of representing the data fields & the access aids used.
DBMS provides Data definition language and Data manipulation language.

Facilities provided by DBMS are,


1.Data Definition Facility (or)Data Definition Language(DDL)
2.Data Manipulation facility (or) Data Manipulation Language(DML)

Fig: The three levels of Architecture

1.DDL: This can be used to define the conceptual schema and also give some details about
how to implement this schema in physical devices used to store data.The definition includes
all the entity set and their associated attributes as well as the relation among the entity
sets.The compiled form of definition is known as Data Dictionary,directory,system
catalogue.

2.DML: The language used to manipulate data in the database is called DML.This involves
retrieval of data the database and deletion or modification of existing data.The first of this
data manipulation operation is called a query.The subset of DML used to pose the query is
known as query language.The DML can be procedural.

Structure of DBMS:

The major components of DBMS are described below.

1.Data definition language compiler:


The DDL compiler converts the data definition statements into a set of
tables. This table contains the metadata concerning the database and are in a form that can be
used by other components of DBMS.

2.Data Manager:

The data manager is the central s/w component of DBMS. One of the
functions of the data manager is to convert the operations in the user queries coming directly
via the query processor or indirectly via an application programmer from the users logical
view to a physical file system. The data manager is responsible for interfacing the file
system.

3.File manager:
Responsibility for the structure of the files and managing the file spaces
rest with the file manager. It is also responsible for locating the block containing the record,
requesting this block from the disc manager and transmitting the required record to the data
manager.

4.Disc Manager:
Disc manager is part of the operation system of the host computer. All
physical input and output operations are performed by it. The discmanager transfers the
blocks or pages request by the file manager.

5.Query processor:
The database user retrieves the data by formulating the query in the data
manipulation language provided with the database.The query processor is used to interpret
the online users query and convert it into an efficient series of operation in a form capable of
being sent to the data manager for execution.

6.Data file:
The data file contains the data portion of the database.

7.Data Dictionary:
Information pertaining to the structure and usage of data contained in the
database, the metadata are maintained in the data dictionary. The data dictionary which is
database itself, documents the data. Each database user can consult the data dictionary to
learn what each piece of data and various synonyms of data file means.

DATA MODELLING:

Data Modeling

Data base is used to store information. To represent the information some modeling is
required. Components in modeling will be according to interest of the object and also the
relationship among the objects.

They are of two types,


3. Object based logical model
4. Record based logical model

2. Object based logical model:

Object based logical model is further classified as


5. ER Model
6. Info logical model
7. Binary model
8. Semantic model
2.Record based logical model:

Record logical model is further classified as

1.Hierarchical model
2.Network model]
3.Relational model

1.Object based logical model:

It is a collection of conceptual tool(which is used to represent the data)for describing data,


data relation and data constraints.

2.Record based logical model:

Which describes the data structures and access techniques of DBMS.

ENTITY – RELATIONSHIP MODEL(ER Model):


The ER data model which is popular for high level database design, provides a means for
representing relationship[ between the entities.

ER model describes entity ,attributes and relationship.

Salient features of ER Diagram:


 This is used to give the structure of the data.
 Model can be evolved independent of any DBMS
 It is an aid for database design
 It is easy to visualize and understand

Sample entities ER-diagram is shown below,

Entity:
Basic thing in ER model. This entity represents the real world thing. Entity can be of
any type. Person is nothing but an entity to an ER diagram. It has different attributes.
Attribute is nothing but a property that describes an entity. Attributes can be of any
type(physical, commercial)Person entity may have attributes of his name,address,phone no.
Entity to Employee attributes are Employee no, Employee name ,Salary,address,Department.

Attributes:
There are three types of attributes.

1.Simple Vs Composite attributes


2.Single value Vs Multivalued attribute
3.Null attribute
RELATIONSHIP:
An association among entities is called relationship.

Example: These exist a relation between students and courses.

This relationship represent a fact that a student enrolls foe a course and the
course as students. The shape of diamond inter-linking the relation.
Student Enrolls Course

TYPES OF RELATIONSHIP:

This will tell the relationship between two entities. There are three types of
relationships.1:n,n:1 and m:n

1) 1:1:
The relationship between a department and manager is 1:1 .There is only
one manager per department and a manager manages only one
department. The 1:1 is shown below:

Manage Manager
Dept
d by

2)1:Many :
The relationship between manager and Employee isone to many shown in the
fig below:

Employe Manage Manager


e r

3)Many: Many:
The relationship Between employee and say a project can be many
to many.
Each employee could be employed in number of different projects and
number of employee could be involved in a project as shown in fig:

Employee Works project


on

For Example: Company database design:

Administration
Marketing
Production
Accounts
--------------All these departments are supervised by a general manager. This general
manager have 1:n relationship among all the departments.

All the other ‘n’ person have relationship with only this single general manager. This
is nothing but n:1 relationship.

Suppose we have several projects and several programmes.This ‘m’ projects can have
relationship with is ‘n’ programmers. This is nothing but m:n relationship.

Notations in ER Diagram:

RECORD BASED LOGICAL MODEL:

(i)HIERARCHICAL:
The model evolved from file based system. In a hierarchical model the
data is organized in a hierarchical way (or)ordered in a tree structure and the database is a
collection of such disjoint trees. The model of the trees represent record type. Each tree
effectively represents a root record type and all of its depends record type.
Fig: Representation of data in hierarchical model.
(ii)NETWORK :

Network data model uses two different data structures to represent the database
entities and relationship among entities ,namely record type & set type.

Record type is used to represent an entity type. It is made up of number of data items
that represent the attributes of the entities. A set type is used to represent a direct relationship
between two record types.

In this model the relation is the only construct required to represent the
association among the attributes of an entity as well as the relationship among different
entities. The relation may be visualized as a name table. Each column of the table
corresponds to attribute of the relation and its name, Rows of the relation are referred as
tuple of the relation and column has it attribute. The value for an
Database users:
1.Application programmer
2.Sophisticated users
3.Specialized users
4.Native users
1.Sophisticated users:
Going to access the data using query. Query will be converted into sequences of
operator through query processor.

2.Specilized:
Going to access a special type of data. Expert system ,information system are accessed by the
specialized user.

3.Native user:
Unsophisticated user. There will be a permanent program, through that the data is accessed.
Through application program we are going to access the data stored in the database.

DBMS COMPONENTS:

The major components of DBMS are explained below.


1.DML pre compiler:
It converts DML statements embedded in an application program to normal procedure calls
in the host language. The pre compiler must interact with the query processor in order to generate
appropriate code.

2.DDL compiler:
The DDL compiler converts the data definition statements into set of tables. This tables
contain information converting the database and are in a form that cab be used by other components of
DBMS.

3.File Manager:
The file manager manages the allocation of location of space on desired storage and the data
structure used to represent in formation store on disk. The file manager can be implemented using an
interface to the existing file sub system provided by the operating system of the host computer (Or) it can
include a file of system written especially for DBMS.

4.Database Manager:
The data manager is the central software components of the DBMS. One of the
functions of the data manager is to convert operations in the users query coming directly via the query
processor (or) indirectly via application program from the users logical view to a ph\7ysical file system.
In addition the task of enrolling constraints to maintain the consistency and integrity
of data ,as well as its security, are also performed by the data manager synchronizing the simultaneous
operation performed by current users is under the control of data manager.

5.Query Processor:
The data base users retrieves data by formulating a query. In the data manipulation
language provided with the DB.The Query processor is used to interpret the online users the online users
query and convert it into an efficient series of operations in a form capable of being sent to the data manager
for executuion.The Query processor uses the data dictionary to find the structure of the relevant portion of
the DB.

Data Files:
The data files contain the portion of the DB.

Data Dictionary:
Information pertaining to the student structure & usage of data contained in the db.The meat
data are maintained in the data Dictionary. The term system catalog also distributes this meta data.The data
dictionary which\h is data base itself documents the data, each data base user can consult the data dictionary
to learn what each piece of data.

Database Administrator(DBA):

Functions of DBA:

Schema Definition
Storage Structure & access method
Modification in storage structure definition and physical organization
Granting authorization for access of data
Integrity constraints
Communicate with the user
Establishing standards & procedures

DBA:

Data base administrator is basically concerned with ensuring that accurate & consistent
information is available to users & application when needed and in the form required. Thus DBA interacts
with both the system & users.

The fig below shows the interaction between users and system.

One of the main reason for having the DBMS is to have control of both data &
program accessing the data .The person having such control over the system is called the data base
administrator(DBA)
The DBA administrator the three levels of database and in consultation with the
overall user community sets up the definition of global view(or)conceptual level of the DB.

The DBA further specifies the external view of the various users and application s &
is responsible for the definition & implementation of the internal level including the storage structure &
access method s to be used for optimum performance of the DBMS. Changes to any of the three levels are
under the control of DBA. Mapping between the internal and the conceptual level as well as between the
conceptual & external level are also defined by DBA.

Ensuring the appropriate measures are in place to maintain the integrity of the DB and
that DB is not accessible to unauthorized user is another responsibility. The DBA is also responsible for
defining procedure to recover the data base from failures due to human, natural,(or)hardware causes with
minimal loss of data. This recovery procedure should enable the organization to continue to function and the
intact portion of the data should continue to be available.

FUNCTION OF DBA:

1)Schema Definition:

The creation of the original DB schema. This is accomplished by writing a set of division
which are translated by the DDL compiler to a set of tables that are permanently stored in the data
dictionary.

2) Storage Structure & access method definition:


The creation of appropriate storage structure & access method .This is accomplished by
writing a set of definition which are translated by the data storage and definition language compiler.

3)Schema & physical organization modification:

Either the modification of the DB schema are the description of the physical storage
organization. The changes although relatively rate ,are accomplished by writing a set of definitions which
are used by either the DDL compiler or the data storage modifications to the appropriate internal system
tables .(For example ,the data dictionary)

4)Granting of authorization for data access:


Authorization for data access to the various users of the database. This allows DBA to regulate ,which part
of the database various users can access .The authorization information is kept in a special system structure
is consulted by the db system whenever accessed to data is attempted in the system..

5)Integrity constraint specification:

This constraints are kept in a special system structure (ie) that is consults by the DB manager
whenever one of the valuable tools that the DBA uses to carry out DBA in data dictionary.
6)Communicating with user:
Databases often have 3 components.

a)Central, widely used DB containing much of the firms data.


b)Several functional DB ,used by limit set of programmers.
Eg:Accounting
c)Dedicated data bases-----used for a single application.

Eg: A Bill of material DB.

The important organization issue here is that the general impact of implementing a DBS is
the firms data. This centralizing data tends to eliminate the local owner ship of data and to reduce
redundancy. Ownership control are transferred to central data dictionary ,which maintain a record of
ownership and use of each data element. Such shifting of control over data may generate some resistant
from user. This resistant should be eliminated by activate educating the users. The DBA provides this
education to the users.

7)Establishing standards & procedures:


Their purpose is effective data abase requires establishment of standard & procedures to
maintain control of data integrity in an efficient way. Standards are particularly applicable to controlling the
development & use databas3 programming & operations.

DATA DICTIONARY:

It is seen that when a program become some what large in size, keeping a track of all
the available names that are used the purpose for which they were used becomes more and more difficult.
Of course it is possible for a programmer who has coined the available names to bear them in mind, but
should the same author. Come back to this program often a significant time (or)should another programmer
have to modify the program. It would be found that it is extremely difficult to make a reliable account for
what purpose the data file was used.

He problem becomes even more difficult when the no. of data types that an organization has
in its data base increased. Therefore some kind of inventory and catalog of it must be ,maintained so
as to assist in both the utilization and management of the resource.

It is for this purpose that a data dictionary are directory is emerging as a major tool and
inventory provides definition of things. A directory tells us where to find him.

A data dictionary contains information or data about the data. A comprehensive data
dictionary would provide the definition of data item, how they fit into data structure &how they
relate to other entities in the data base. With the base of information the data dictionary can serve
several useful purposes connecting across the whole spectrum odf planning ,determining information
requirement, designing& implementation operation & revision.

There is now a greater emphasis on the data dictionary having an integrates system.

The DBA uses the data dictionary in every phase of database life cycle, starting from the data
gathering phase to the design, implementation maintenance phases. Documentation provided
by a end users & manages as it programmers .End user are nothing but sophisticated users.
Users can plan their application I\\with the DB only if they know exactly what is stored in it.

For Example:
The description of data item in a data dictionary make includes its origin and other text
description in English ,in addition to its data format.

This users and managers will be able to see exactly what is available e on the DB.We could
consider a data dictionary to be a road map which guides users to access information within a
large database.

An ideal data dictionary should include everything in a DB wants to know about the data
base.

1)External ,conceptual & internal database description.


2)Description of entities , attributes as well as cross-references, origin & meaning of data
elements.
3)meanings, authorization and security codes.
4)Which external schema are used by which programs, who the users are and what their
authorization are.

The data dictionary is implemented as a database so that user can query its content by
either interactive (or) batch processing .A data dictionary can be a great assets not only to
the DBA for DB design, implementation & maintenance but also to managers to end users in
their project planning.

You might also like