0.introductory Concept of DBMS
0.introductory Concept of DBMS
A person who has such central control over the system is called a database administrator (DBA). The
functions of a DBA include:
Schema definition. The DBA creates the original database schema by executing
a set of data definition statements in the DDL.
Storage structure and access-method definition.
Schema and physical-organization modification. The DBA carries out changes to the schema and
physical organization to reflect the changing needs of the organization, or to alter the physical
organization to improve performance.
Granting of authorization for data access. By granting different types of authorization, the
database administrator can regulate which parts of the database various users can access. The
authorization information is kept in a special system structure that the database system consults
whenever someone attempts to access the data in the system.
Routine maintenance. Examples of the database administrator’s routine maintenance activities
are:
Periodic backing up the database, either onto tapes or onto remote servers, to prevent loss of data
in case of disasters such as flooding.
Ensuring that enough free disk space is available for normal operations and upgrading disk space
as required.
Monitoring jobs running on the database and ensuring that performance is not degraded by very
expensive tasks submitted by some users.
Prepared By: - Prof. Munira Topia, Computer Engineering Department, L. J. Institute of Engineering &
Technology, Ahmedabad
2
Prepared By: - Prof. Munira Topia, Computer Engineering Department, L. J. Institute of Engineering &
Technology, Ahmedabad
3
5. Atomicity problems. A computer system, like any other device, is subject to failure. In many
applications, it is crucial that, if a failure occurs, the data be restored to the consistent state that
existed prior to the failure.
Consider a program to transfer $500 from the account balance of department A to the account
balance of department B. If a system failure occurs during the execution of the program, it is
possible that the $500 was removed from the balance of department A but was not credited to the
balance of department B, resulting in an inconsistent database state.
Clearly, it is essential to database consistency that either both the credit and debit occur, or that
neither occur. That is, the funds transfer must be atomic—it must happen in its entirety or not at
all. It is difficult to ensure atomicity in a conventional file-processing system.
6. Concurrent-access anomalies Interaction of concurrent updates is possible and may result in
inconsistent data.
Consider department A, with an account balance of $10,000. If two department clerks debit the
account balance (by say $500 and $100, respectively) of department A at almost exactly the same
time, the result of the concurrent executions may leave the budget in an incorrect (or
inconsistent) state.
Suppose that the programs executing on behalf of each withdrawal read the old balance, reduce
that value by the amount being withdrawn, and write the result back. If the two programs run
concurrently, they may both read the value $10,000, and write back $9500 and $9900,
respectively. Depending on which one writes the value last, the account balance of department A
may contain$9500 or $9900, rather than the correct value of $9400.
To guard against this possibility, the system must maintain some form of supervision. But
supervision is difficult to provide because data may be accessed by many different application
programs that have not been coordinated previously.
7. Security problems. Not every user of the database system should be able to access all the data.
For example, in a university, payroll personnel need to see only that part of the database that has
financial information. They do not need access to information about academic records. But, since
application programs are added to the file-processing system in an ad hoc manner, enforcing such
security constraints is difficult.
These difficulties, among others, prompted the development of database systems.
Prepared By: - Prof. Munira Topia, Computer Engineering Department, L. J. Institute of Engineering &
Technology, Ahmedabad
4
Universities: For student information, course registrations, and grades (in addition to standard
enterprise information such as human resources and accounting).
Airlines: For reservations and schedule information. Airlines were among the first to use
databases in a geographically distributed manner.
Telecommunication: For keeping records of calls made, generating monthly bills, maintaining
balances on prepaid calling cards, and storing information about the communication networks.
4) What is data independence? Explain the difference between physical and logical data
independence with example.[LJIET] Dec 2010
OR
What is data independence? Explain different types of data independence with suitable
example.[LJIET] Nov 2013
OR
“Data independence is the ability to modify a schema definition in one level without affecting a
schema definition in next higher level”.
Data independence is the major objective of the database systems. It is implemented through the
three levels of data abstraction.
There are two levels of data independence:
1. Physical data independence
2. Logical data independence
Languages support the notion of a structured type. For example, we may describe
a record as follows:
type instructor = record
ID : char (5);
name : char (20);
dept name : char (20);
salary : numeric (8,2);
end;
This code defines a new record type called instructor with four fields. Each field has a name and a
type associated with it. A university organization may have several such record types, including
• Department, with fields dept name, building, and budget
• Course, with fields course id, title, dept name, and credits
• Student, with fields ID, name, dept name, and tot cred
At the physical level, an instructor, department, or student record can be described as a block of
consecutive storage locations. The compiler hides this level of detail from programmers. Similarly,
the database system hides many of the lowest-level storage details from database programmers.
Database administrators, on the other hand, may be aware of certain details of the physical
organization of the data.
Prepared By: - Prof. Munira Topia, Computer Engineering Department, L. J. Institute of Engineering &
Technology, Ahmedabad
6
At the logical level, each such record is described by a type definition, as in the previous code
segment, and the interrelationship of these record types is defined as well. Programmers using a
programming language work at this level of abstraction. Similarly, database administrators usually
work at this level of abstraction.
Finally, at the view level, computer users see a set of application programs that hide details of the
data types. At the view level, several views of the database are defined, and a database user sees
some or all of these views. In addition to hiding details of the logical level of the database, the views
also provide a security mechanism to prevent users from accessing certain parts of the database.
For example, clerks in the university registrar office can see only that part of the database that has
information about students; they cannot access information about salaries of instructors.
A database system is partitioned into modules that deal with each of the responsibilities of the overall
system. The functional components of a database system can be broadly divided into the storage
manager and the query processor components.
Storage Manager
The storage manager is the component of a database system 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 for the interaction with the file manager. The raw data
are stored on the disk using the file system provided by the operating system. The storage manager
translates the various DML statements into low-level file-system commands. Thus, the storage
manager is responsible for storing, retrieving, and updating data in the database.
The storage manager components include:
• Authorization and integrity manager, which tests for the satisfaction of integrity constraints and
checks the authority of users to access data.
• Transaction manager, which ensures that the database remains in a consistent (correct) state despite
system failures, and that concurrent transaction executions proceed without conflicting.
• File manager, which manages the allocation of space on disk storage and the data structures used to
represent information stored on disk.
• Buffer manager, which is responsible for fetching data from disk storage into main memory, and
deciding what data to cache in main memory. The buffer manager is a critical part of the database
system, since it enables the database to handle data sizes that are much larger than the size of main
memory. The storage manager implements several data structures as part of the physical system
implementation
• Data files, which store the database itself.
• Data dictionary, which stores metadata about the structure of the database, in particular the schema
of the database.
• Indices, which can provide fast access to data items. Like the index in this textbook, a database
index provides pointers to those data items that hold a particular value. For example, we could use an
index to find the instructor record with a particular ID, or all instructor records with a particular
name.
The Query Processor
Prepared By: - Prof. Munira Topia, Computer Engineering Department, L. J. Institute of Engineering &
Technology, Ahmedabad
7
• DDL interpreter, which interprets DDL statements and records the definitions in the data
dictionary.
• DML compiler, which translates DML statements in a query language into an evaluation plan
consisting of low-level instructions that the query evaluation engine understands.
A query can usually be translated into any of a number of alternative evaluation plans that all give
the same result. The DML compiler also performs query optimization; that is, it picks the lowest cost
evaluation plan from among the alternatives.
• Query evaluation engine, which executes low-level instructions generated by the DML compiler.
Prepared By: - Prof. Munira Topia, Computer Engineering Department, L. J. Institute of Engineering &
Technology, Ahmedabad
8
There are four different types of database-system users, differentiated by the way they expect to
interact with the system. Different types of user interfaces have been designed for the different types
of users.
Naive users: are unsophisticated users who interact with the system by invoking one of the
application programs that have been written previously. For example, a clerk in the university
who needs to add a new instructor to department A invokes a program called new hire. This
program asks the clerk for the name of the new instructor, her new ID, the name of the
department (that is, A), and the salary. The typical user interface for naive users is a forms
interface, where the user can fill in appropriate fields of the form. Naive users may also simply
read reports generated from the database. As another example, consider a student, who during
class registration period, wishes to register for a class by using a Web interface. Such a user
connects to a Web application program that runs at a Web server. The application first verifies
the identity of the user, and allows her to access a form where she enters the desired information.
The form information is sent back to the Web application at the server, which then determines if
there is room in the class (by retrieving information from the database) and if so adds the student
information to the class roster in the database.
Application programmers are computer professionals who write application programs.
Application programmers can choose from many tools to develop user interfaces. Rapid
application development (RAD) tools are tools that enable an application programmer to
construct forms and reports with minimal programming effort.
Sophisticated users interact with the system without writing programs. Instead, they form their
requests either using a database query language or by using tools such as data analysis software.
Analysts who submit queries to explore data in the database fall in this category.
Specialized users are sophisticated users who write specialized database applications that do not
fit into the traditional data-processing framework. Among these applications are computer-aided
design systems, knowledgebase and expert systems, systems that store data with complex data
types (for example, graphics data and audio data), and environment-modeling systems.
A database system provides a data-definition language to specify the database schema and a data-
manipulation language to express database queries and updates.
Data-Manipulation Language
A data-manipulation language (DML) is a language that enables users to access or manipulate
data as organized by the appropriate data model. The types of access are:
• Retrieval of information stored in the database
• Insertion of new information into the database
• Deletion of information from the database
• Modification of information stored in the database
There are basically two types:
• Procedural DMLs require a user to specify what data are needed and how to get those data.
• Declarative DMLs (also referred to as nonprocedural DMLs) require a user to specify what data
are needed without specifying how to get those data. Declarative DMLs are usually easier to
learn and use than are procedural DMLs. However, since a user does not have to specify how to
get the data, the database system has to figure out an efficient means of accessing data.
A query is a statement requesting the retrieval of information. The portion of a DML that
involves information retrieval is called a query language. One example of non procedural query
language is SQL.
Prepared By: - Prof. Munira Topia, Computer Engineering Department, L. J. Institute of Engineering &
Technology, Ahmedabad
9
A query takes as input several tables (possibly only one) and always returns a single table. Here
is an example of an SQL query that finds the names of all instructors in the History department:
Select instructor.name from instructor where instructor.dept name = ’History’;
The query specifies that those rows from the table instructor where the dept name is History must
be retrieved, and the name attribute of these rows must be displayed. More specifically, the result
of executing this query is a table with a single column labeled name, and a set of rows, each of
which contains the name of an instructor whose dept name, is History.
Data-Definition Language
We specify a database schema by a set of definitions expressed by a special language called a
data-definition language (DDL). The DDL is also used to specify additional properties of the
data. We specify the storage structure and access methods used by the database system by a set of
statements in a special type of DDL called a data storage and definition language. These
statements define the implementation details of the
database schemas, which are usually hidden from the users. The data values stored in the
database must satisfy certain consistency constraints. For example, suppose the university
requires that the account balance of a department must never be negative. The DDL provides
facilities to specify such constraints. The database system checks these constraints every time the
database is updated.
The DDL, just like any other programming language, gets as input some instructions (statements)
and generates some output. The output of the DDL is placed in the data dictionary, which
contains metadata—that is, data about data. The data dictionary is considered to be a special type
of table that can only be accessed and updated by the database system itself (not a regular user).
The database system consults the data dictionary before reading or modifying actual data.
Example: SQL provides a rich DDL that allows one to define tables, integrity constraints,
assertions, etc.
For instance, the following SQL DDL statement defines the department table:
create table department (dept name char (20), building char (15), budget numeric (12,2));
Execution of the above DDL statement creates the department table with three columns: dept
name, building, and budget, each of which has a specific data type associated with it.
Data Control Language
This gives data authorization to specific users for specific data. In SQL , GRANT and REVOKE
command are used for the same
Though Data Administrator (DA) and Database Administrator (DBA) both are responsible for
managing database for an organization, they both are different from each other in their required skills
and responsibilities
Data Administrator (DA)
- DA is a person in the organization who controls the data of database.
- DA determines what data to be stored in database based on requirements of the organization.
- DA is involved more in requirement gathering, analysis and design phases.
- DA is a manager or some senior level person in an organization who understands organizational
requirements with respect to data.
- DA does not need to be a technical person, but any kind of knowledge about database technology
can be beneficiary.
Database Administrator (DBA)
- The DBA is a person in the organization who controls the design and the use of the database.
- DBA provides necessary technical support for implementing a database.
- DBA is involved more in design, development, testing and operational phases.
Prepared By: - Prof. Munira Topia, Computer Engineering Department, L. J. Institute of Engineering &
Technology, Ahmedabad
10
Prepared By: - Prof. Munira Topia, Computer Engineering Department, L. J. Institute of Engineering &
Technology, Ahmedabad