Professional Documents
Culture Documents
Database Management System Unit-I: Efficient To Use
Database Management System Unit-I: Efficient To Use
UNIT-I
Introduction
Levels of Abstraction
View of Data
Data Models
Entity-Relationship Model
Relational Model
SQL
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
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
_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:
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.
DATABASE SYSTEM:
Computerized record keeping file. Its purpose to give the information on the demand
and also to store the information.
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.
2. Constructing:
Storing the same database in a storage area.
3. Manipulating:
Querying the database and appending the database.
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
Data
Integrated Shared
Example databases:
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.
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.
MULTIMEDIA
ADVANCED DATABASE IT64 4 IT
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
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.
The database can be changed at the inclusion and deletion.The collection of database at the
moment can be defined as instances of data.
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.
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
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.
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.
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 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.
1.Hierarchical model
2.Network model]
3.Relational model
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.
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:
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:
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:
(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.
(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:
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:
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)
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.
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.
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.
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.
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.
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:
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.
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.
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.
CUSTOMER Account
Samples E-R diagram.
A-101 500
A-215 700
A-102 400
A305 350
A-201 900
A-217 750
A-222 700
A-215 700
A-201 900
Jones 321-12-3123 Main
A-217 750
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.
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.
Users
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
Introduction :
Database Applications:
Levels of Abstraction
Entity-Relationship Model
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
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:
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.
DATABASE SYSTEM:
Computerized record keeping file. Its purpose to give the information on the
demand and also to store the information.
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.
2. Constructing:
Storing the same database in a storage area.
3.Manipulating:
Querying the database and appending the database.
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:
Data:
Data can be integrated and data can be shared.
Data
Integrated Shared
Example databases:
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
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:
MULTIMEDIA
ADVANCED IT64 4 IT
DATABASE
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.
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.
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
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.
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.
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:
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.
1.Hierarchical model
2.Network model]
3.Relational model
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.
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:
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:
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:
(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:
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.
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)
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.
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.
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.
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.