Académique Documents
Professionnel Documents
Culture Documents
TRADEMARKS: All brand name and product names mentioned in this book are trademarks or registered trademark of their
respective companies.
Every effort has been made to supply complete and accurate information. However, CEDTI assumes no responsibility for its
use, nor for any infringement of the intellectual property rights of third parties which would result from such use.
No part of this publication may be stored in a retrieval system, transmitted or reproduced in any forms or by any means,
electronic, photocopy, photograph, magnetic or otherwise, without written permission of CEDTI.
CEDTI/CFS/99/6/3.1/R1
FOREWORD
The Information Technology and Telecom sectors have suddenly opened up avenues,
which require a very large specially trained manpower. These sectors are highly dynamic and
need training and re-training of manpower at a rapid rate. The growing gap of requirement of
the industry and its fulfillment has created a challenging situation before manpower training
institutes of the country. To meet this challenge most effectively, Centre for Electronics Design
and Technology of India (CEDTI) has launched its nation-wide franchising scheme.
Centre for Electronics Design and Technology of India (CEDTI) is an Autonomous Scientific Society under
the Govt. of India, Department of Electronics with its Headquarters at New Delhi. It operates seven centres
located at Aurangabad, Calicut, Gorakhpur, Imphal, Mohali, Jammu and Tezpur. The scheme will be implemented
and coordinated by these centres.
The scheme endeavours to promote high quality computer and information technology
education in the country at an affordable cost while ensuring uniform standards in order to
build a national resource of trained manpower. Low course fees will make this education
available to people in relatively small, semi urban and rural areas. State-of-the-art training will
be provided keeping in view the existing and emerging needs of the industrial and Govt.
sectors. The examinations will be conducted by CEDTI and certificates will also be awarded
by CEDTI. The scheme will be operated through all the seven centres of CEDTI.
The CEDTI functions under the overall control and guidance of the Governing Council
with Secretary, Department of Electronics as its Chairman. The members of the council are
drawn from scientific, government and industrial sectors. The Centres have separate executive
committees headed by Director General, CEDTI. The members of these committees are from
academic/professional institutes, state governments, industry and department of electronics.
CEDTI is a quality conscious organisation and has taken steps to formally get recognition
of the quality and standards in various activities. CEDTI, Mohali was granted the prestigious
ISO 9002 certificate in 1997. The other centres have taken steps to obtain the certification as
early as possible. This quality consciousness will assist CEDTI in globalizing some of its
activities. In keeping with its philosophy of Quality in every Activity, CEDTI will endeavour to
impart state of the art computer and IT training through its franchising scheme.
The thrust of the Software Courses is to train the students at various levels to carry out
the Management Information System functions of a medium sized establishment, manufacture
Software for domestic and export use, make multimedia presentations for management and
effectively produce various manufacturing and architectural designs.
(R. S. Khandpur)
Director General (CEDTI)
TABLE OF CONTENTS
UNIT
CHAPTER NAME
PAGE NO.
11
DATA ABSTRACTION
13
DATA MODEL
15
KEYS
21
DATABASE MANAGER
23
DATABASE ADMINISTRATOR
25
CONCURRENCY CONTROL
27
STORAGE MANAGEMENT
29
10
DATA INDEPENDENCE
31
11
DATABASE USERS
33
12
35
13
39
14
41
15
NORMALIZATION
43
PREFACE
RDBMS FUNDAMENTALS
RDBMS FUNDAMENTALS
CHAPTER - 1
RDBMS FUNDAMENTALS
EMPCD
NAME
ADD
JDATE
A001
A002
A003
A004
Smith
Allen
Jones
Michael
Delhi
Bombay
London
Tokyo
01-01-1991
012-1991
01-02-1992
01-02-1993
Note:
Here EMPCD, NAME, ADD, JDATE, meanings are employee code, employee name, employee address, employee joining date.
Database is the solution to store, reference and view the information in various forms. It
provides various tools and objects to view the information stored as table. It provides more
efficient and herbal way to manage the information compared to an ordinary file system.
DBMS provides organization, with the capability to easily integrate and leverage the massive
amounts of operational data into meaningful information.
A database management system (*DBMS) is a collection of programs that enables users to
create and maintain a database. The DBMS is hence a general-purpose software system
that facilitates the processes of defining, constructing and manipulating database for various
applications. Defining a database involves specifying the data types, structures and constraints for the data to be stored in the database. Construction the database is the process of
storing the data itself on some storage medium that is controlled by the DBMS. Manipulating
a database includes such function as querying the database to retrieve specific data, updating the database to reflect changes in the mini world, and generating report form the data.
It is necessary to use general-purpose DBMS software for implementing a computerized
database. We could write our won set of programs to create and maintain the database in
effect creating through own special purpose DBMS software. In either case whether we use
a general purpose DBMS or not we usually have to employ a considerable amount of
software to manipulate the database in addition to the database itself. We will call the database and software together a database system.
10
RDBMS FUNDAMENTALS
CHAPTER - 2
11
RDBMS FUNDAMENTALS
The data values stored in the data must satisfy certain type of consistency constraints. For
example the balance of the bank account may never fall below the prescribed amount (say
Rs.200). These constraints are reinforced in system by adding appropriate code in various
application.
12
RDBMS FUNDAMENTALS
CHAPTER - 3
DATA ABSTRACTION
Purpose of database system is to provide users, with an abstract view of data i.e. system
hides several details of how data is stored and maintained. They are three levels of data
abstraction
l
l
l
Physical level
Conceptual level
View level
Physical Level
It is lowest level of abstraction & it describes how the data are actually stored. At the physical
level, complex low level data structures are described in detail.
Conceptual Level
New higher level of abstraction describes what data are actually stored and relationship that
exist among the data.
View Level
It is the highest level of abstraction, it describes only part of the database. To simplify their
interaction with the system, the view level of abstraction is defined.
Example:- we can observe the difference between physical, conceptual, and view levels of
abstraction. In particular, we talk about arrays. On the conceptual level, we might use an
ordinary declaration such as integer array A[1..n.,1..m] while on the physical level we might
see the array A as stored in a block of consecutive storage locations, with A[i,j] in location
a0+4(m(i-1)+j-1). A view of array A might be formed by declaring a function f(i) to be the sum
13
RDBMS FUNDAMENTALS
from j= 1to m of A[i,j]. In this view we have observed some of the information, since we can
only see the sums of rows. The query processor accepts queries that are about view or about
the conceptual database itself, and translates them into sequences of commands that make
sense to the physical database.
view
view
view
Logical
Physical
Figure 1
14
view
RDBMS FUNDAMENTALS
CHAPTER - 4
DATA MODEL
Data model is a collection of tools for describing data, data relationship, data semantics and
consistency constraints. There are three data models:
I.
II.
III.
1.
2.
It consist of collection of basic objects called entities and relationship among these objects.
An entity is an objects that is distinguishable from other objects by a specific set of attributes.
A relationship is an association among several entities. Hence collection of entities of some
type are entity set while set of relationship of same entities is called relationship set.
15
RDBMS FUNDAMENTALS
E-R Diagrams
Overall logical structure of database can be expressed graphically by an E-R diagram which
consist of following components.
Rectangle .................................................... Represent entity set.
Ellipse .......................................................... Represent attributes
Diamonds .................................................... Relationship among entity set.
Lines ............................................................ Links attributes to entity sets to relationship.
Example
customer : Cust_name, street, city
Account : Acc_no, balance
Cust. Name
Street
Customer
City
Account
Deposit
Balance
Account
Figure 2
The Object Oriented Model
The object_oriented model is based on a collection of objects. An object contains values are
themselves object. An object also contains bodies of code that operate on the object. These
bodies of code are called methods. Objects that contain the same types of values and the
same methods are grouped together into class.
Record_Based Logical Models
Record _ based logical models are used in describing data at the conceptual and view levels.
This is not a mechanism for the direct representation of code in the database instead, there
are separate languages that are associated with the model to express database queries and
updates. Here three most widely accepted data models are:
l
l
l
Relational Model
Network Model
Hierarchical Model
16
RDBMS FUNDAMENTALS
Relational Model
The relational model uses a collection of tables to represent both data and the relationships
among those data. Each table has multiple columns, and each column has unique name.
The below example shows a simple relational database comprising of two tables. One table
shows bank customers, second table shows the account belong to those customers.
Example :
Customer and Account entity sets have the following attributes
Customer (Cust_Name, Street,City, Ac_No)
Account (Ac_No, Balance)
Customer
Street
City
A/c No.
A/C No.
Sreenu
Shree
Sreenu
Dipalcer
North
South
Noth
Main
Hyd.
MNR
Hyd.
HH
A-201
A-101
A-50
A-60
A-201
2500
A-50
A-60
Balance
9000
1100
6000
Figure 3
Advantages
It supports many-to-many relationship
Data independence is achieved as tables can be change without affecting the
tions.
Data is operated as a set at a time rather than a record at a time.
Applica-
Disadvantages
Requires large amount of memory and high speed processor
Network Model
Data in the Network Model are represented by collection of records (in the Pascal) and relationship among data are represented by links, which can be viewed as pointers. The records
in the database are organized as collections of arbitrary graphs.
Advantages
The information is accessed much faster.
Less storage is required.
Allows many-to-many relationships.
Disadvantages
Due to its complicated structure, this requires data manipulation through complicated query
language.
17
RDBMS FUNDAMENTALS
Example:
Customer and Account entity sets have the following attributes
Customer (Cust_name, Street, City,)
Account (Ac_No.,Balance)
Sreenu
North
------
A-201
900
Shankar
South
------
A-101
2500
Dipak
Main
------
A-50
1100
A-50
1100
Figure 4
Hierarchical Model
The hierarchical model is similar to the network model in the sense that data and relationships among data are represented by records and links respectively. The difference from
network model in that records are organized as collections of trees rather than arbitrary graphs.
Advantages
Its ability to handle large quantities of data.
High performance.
Storage capacity.
Disadvantages
very rigid and complex.
Rigidity makes the queries complex.
Very slow
Example :
Customer and Account entity sets have the following attributes
Customer (Cust_Name, Street, City)
Account (Ac_No, Balance)
18
RDBMS FUNDAMENTALS
Sreenu
North
------
A-201
900
Shankar
South
------
A-101
2500
Dipak
Main
------
A-50
1100
A-60
1100
Figure 4
Figure 5
Physical Model
Physical data models describe how data is stored in the computer by representing information such as record formats, record orderings, and access paths. An access path is a structure that makes the search for particular database efficient.
19
RDBMS FUNDAMENTALS
20
RDBMS FUNDAMENTALS
CHAPTER - 5
KEYS
l
l
l
Super Key
Candidate Key
Primary Key
A super key is a set of one or more attributes. That allows us to identify uniquely an entity in
the entity set.
Example :
The account_number (super key) attribute of the entity set customer is sufficient to distinguish one customer entity from another.
If K is a super key, then so is any superset of K. We are often interested in super key for which
no proper subset is super key. Such minimal super keys are called candidate keys.
We shall use the term primary key to denote a candidate key that is chosen by the database
designer as the principal means of identifying entities within an entity set. A key (primary,
candidate, super) is a property of the entity set.
21
RDBMS FUNDAMENTALS
22
RDBMS FUNDAMENTALS
CHAPTER - 6
DATABASE MANAGER
The Database Manager is a program module which provides the interface between the low
level data stored in the database and the application programs and queries submitted to the
system. The Database Manager is responsible for the following tasks:
Interaction with the file Manager
Database Manager is responsible for actual storing, retrieving and updating of data in the
database.
Integrity Enforcement
Most database applications have certain integrity constraints that must hold for the data. A
DBMS should provide capabilities for defining and enforcing these constraints. The simplest
type of integrity constraints involves specifying a data type for each data item.
The values stored in the database must satisfy certain types of consistency constraints.
The Database Manager can determine whether updates to the database result in the violation
of the constraints. Database Manager can take an appropriate action must be taken. A data
item may be entered and yet still satisfy the specified integrity constraints. For example, if a
students receives a grade of A but a grade of C is entered in the database, the DBMS
cannot discover this error automatically, because C is a valid value for the Grade data type.
Such data entry errors can only be discovered manually ( when the student receives the
grade) and corrected later by updating the database. However, a grade of X can be
automatically rejected by the DBMS, because X is not valid value for the grade data type.
Security Enforcement
Every Database user need to have access to the entire content of the database. It is the job
of DBM to enforce these security requirements.
23
RDBMS FUNDAMENTALS
24
RDBMS FUNDAMENTALS
CHAPTER - 7
DATABASE ADMINISTRATOR
DBA
Database administrator is a persons having central control both data and programs accessing that data. The DBA system is the block of code loaded from the hard disk drive by the
person who is responsible for the overall control of the database applications. And this
person becomes the Oracle Data Base Administrator. This person is responsible for administrating all of Oracles resources and allows the user to access these resources.
Following are the functions taken care by DBA.
Updating the database.
Accepting SQL statements
Retrieving information from the database
Enforcing data security specifications
Enforcing the data integrity specifications
Managing the data sharing
Optimizing queries
Managing system catalogues
Managing the transactions control
Scheme Definition
The DBA creates the original database schema by writing a set of definitions which are translated by the DDL compiler to a set of tables that are permanently stored in the data dictionary.
(Note :- detail of scheme def given next page).
Storage structure and access method definition
Appropriate storage structures and access methods are created by writing a set of definitions
which are translated by the data storage and definition language compiler. Scheme and
Physical organization modification. Modifications to either the database scheme or the description of the physical storage organization are accomplished by writing a set of definition
which are used by either the DDL compiler or the data storage and definition language compiler to generate modifications to the appropriate internal system tables.
25
RDBMS FUNDAMENTALS
26
RDBMS FUNDAMENTALS
CHAPTER - 8
CONCURRENCY CONTROL
Several problems can occur when concurrent transactions execute in an uncontrolled manner
The problems that may occur are
-
Read-item(X):
X:=X+M
27
RDBMS FUNDAMENTALS
28
RDBMS FUNDAMENTALS
CHAPTER - 9
STORAGE MANAGEMENT
The Storage Manager is a problem module. This contain three major parts they are Transaction Manager, Buffer Manager and File Manager. This provides the interface between the
low-level (disk) data stored in the data base 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, which is usually provided
by a conventional operating system. The storage manager translates the various DML statements into low-level file-system commands. The storage manager is responsible for storing,
retrieving, and updating of data in the database.
29
RDBMS FUNDAMENTALS
30
RDBMS FUNDAMENTALS
CHAPTER - 10
DATA INDEPENDENCE
The three-schema architecture can be used for explaining the concept of data independence,
which can be defined as the capacity to change the scheme at one level of a database
system without having to change the schema at the next higher level. We can define two
types of data independence.
1.
Logical data independence is the capacity to change the conceptual schema without
having to change external schemes or application programs. We may change the
conceptual schema to expand the database (by adding a new record type or data item),
or to reduce the database (by removing a record type or data item). In the latter case,
external schemes that refer only to the remaining data should not be affected. Only the
view definition and the mappings need to be changed in the DBMS that supports logical
data independence. Application programs that reference the external schema constructs
must work as before after the conceptual scheme undergoes a logical reorganisation.
Changes to constraints can also be applied to the conceptual schema without affecting
the external schemas.
2.
Physical data independence is the capacity to change the internal schema without having
to change the conceptual (or external) schemas. Changes to the internal schema may
be needed because some physical files had to be reorganised for example, by creating
additional access structures to improve the performance of retrieval of update. If the
same data as before remains in the database, we should not have to change the
conceptual schema. For example, providing an access path to improve retrieval of
SECTION records by Semester and Year should not require a query such as list all
sections offered in Fall 1991 to be changed, although the query can be executed more
efficiently by the DBMS by utilising the new access path. Because physical data
independence refers to the insulation of an application from the physical storage structures
only, it is easier to achieve that logical data independence.
Whenever we have a multiple level DBMS, its catalogue must be expanded to include
information on how to map requests and data among the various levels. The DBMS uses
additional software to accomplish these mapping by referring to the mapping information in
the catalogue. Data independence is accomplished because, when the schema is changed
at some level, the schema at the next higher level remains unchanged; only the mapping
between the two levels is changed. Application programs referring to the higher level scheme
31
RDBMS FUNDAMENTALS
need not be changed. Hence, the three-schema architecture can make it easier to achieve
true data independence, both physical and logical. However, the two levels of mapping
create an overhead during compilation or execution of a query or program, leading to
inefficiencies in the DBMS. Because of this, few DBMSs have implemented the full threeschema architecture.
32
RDBMS FUNDAMENTALS
CHAPTER - 11
DATABASE USERS
There are four types users can use this database
Application Programmers
The person who interact with the system through DML, calls the application programs written
in host language. These programs are commonly referred to as application program. Example
in banking system include programs that generate payroll checks, that credit accounts, or that
transfer funds between account.
Sophisticated Users
Sophisticated user interact with the system without writing programs. They form their request
in a database query language. Each such query is submitted to a query processor whose
function is to break down DML statements into instruction that the storage manager
understand.
Specialised User
Some sophisticated users write specialised data base application that do not fit into the
traditional data-processing framework. Among these applications are computer-aided design
systems, knowledge based and expert systems.
End User or (Native User)
Unsophisticated user interact with the system by invoking one of the permanent application
programs that have been written previously.
33
RDBMS FUNDAMENTALS
34
RDBMS FUNDAMENTALS
CHAPTER - 12
RDBMS FUNDAMENTALS
Buffer manager
Which is responsible for fetching data from disk storage into main memory, and deciding what
data to cache in memory.
File manager
Which manages the allocation of space on disk storage and the data structures used to
represent information stored on disk.
Data files, which store the database itself.
-
Data dictionary
Which stores metadata about the structure of the database. The data dictionary is used
heavily. Therefore, great emphasis should be placed on developing a good design and efficient
implementation of the dictionary.
-
Indexes
Which provides fast access to data items that hold particular values.
-
Statistical data
Which store statistical information about the data in the database, this information is used by
the query processor to select efficient ways to execute a query.
-
Security
Database security usually refers to security form malicious access. Security needed for
protecting the database item securing form unauthorised persons who are not allowed to
access part of or whole of the database Security is specified in terms of authorisation
constraints. The database administration can prevent mischief through his privileges of
36
RDBMS FUNDAMENTALS
Access creation
Privilege granting
Privilege revocation
The database administrator can give several forms of authorisation to a user to ensure security
-
Read authorization
Insert authorisation
Update authorisation
Delete authorisation
A user may be assigned all, none or a combination of the above type of authorisation. Another
way to ensure security is to encrypt sensitive data so that it is meaningless for unauthorised
people enen. If they are able to somehow access it.
Integrity
This ensures that database is kept in a consistent statement with respect to the constraints
specified on the database.
The constraints on a data model can be implicit these are integrity constraints that can be
specified and represented in the database schema of that model Expect those constraints
which may occur in but a data model not capable of Inherent: these do not have to be
specified in a schema but are assumed to hold by the definition of the model constructs.
In a relational model the key and entity integrity constraints are considered to be implicit not
be relational model.
An inherent constraint in the relational model is that an accurate value is indivisible
37
RDBMS FUNDAMENTALS
38
RDBMS FUNDAMENTALS
CHAPTER - 13
39
RDBMS FUNDAMENTALS
40
RDBMS FUNDAMENTALS
CHAPTER - 14
41
RDBMS FUNDAMENTALS
There are two main types of DMLs. A high-level or non-procedural DML can be used on its
own to specify complex database operations in a concise manner. Many DBMSs allow highlevel DML statements either to be entered interactively from a terminal or to be embedded in
a genral-purpose programming language. In the latter case, DML statements must be identified
within the program so that they can be processed by the DBMS. A low-level or procedural
DML must be embedded in a gernal purpose programming language. This type of DML
typically retrieves individual records from the database and the processes each record
separately. Hence, it needs to make use of programming language constructs, such as looping,
to retrieve and process each individual record from a set of records. Low-level DMLs, are
also called records at a time DMLs because of this property. High-level DMLs, such as SQL,
can specify and retrieve many records in a single DML statement and are hence called set-ata-time or set oriented DMLs. A query in a high level DML often specifies what data is to be
retrieved rather than how to retrieve the data; hence, such languages are also called declarative.
Whenever DML, commands whether high-level or low-level, are embedded in a general purpose
programming language, that language is called the host language and the DML is called the
data sublanguage. In a newer DBMSs, such as object-oriented system the host and data
sublanguage typically form one integrated language such as C + +. On the other hand, a
high-level DML used in a stand-alone interactive manner is called a query language. In
general, both retrieval and update commands of a high-level DML may be used interactively
and are hence considered part of the query language.
Casual end users typically use a high-level query language to specify their requests, whereas
programmers use the DML in its embedded form. For native and parametric users, there
usually are user-friendly interfaces for interacting with the database; these can also be used
by casual users or other who do not want to learn the details of high-level query language. We
discuss these types of interfaces next.
42
RDBMS FUNDAMENTALS
CHAPTER - 15
NORMALIZATION
Normalization is a database techniques used to eliminate complex data structures and to
completely eliminate redundancy. In fact when you normalize database and break it in pieces,
it gives you flexibility in developing ennumerous relations.
A relation is said to be in a particular normal form if it satisfies a certain specified set of
constraints.
Functional Dependence (F.D.)
Def.: Given a relation R, attribute Y of R is functionally dependent on attribute X of R #
and only it, whenever two tuples of R Agree on their x-value, they also agree on their Y value.
For example - In the suppliers and parts database, attributes. SNAME, STATUS, CITY of
relations S are each functionally dependent on attribute S # because, given a particular
value for S#, there exists precisely one corresponding value for each of SNAME, STATUS
AND CITY.
S.S# - (SNAME, STATUS, CITY).
The statement S.S# - S. CITY is read as S. city is functionally dependent all attribute S.S#
or, eq uivalently, attribute S.S# functionally determines attribute S. City or, more sufficiently.
S.S # S. (SNAME, STATE, CITY)
The statement S.S.# - S.city is read as s.city is functionally dependent on attribute S.S. or
equivalently, attribute S.S. functionally determines attribute S.City.
FULLY, Functional, DEPENDENCE
Deg. :
attribute Y is fully functionally dependent on attribute x of it is functionally dependent
on x and not functionally dependent on any other attribute.
Ex. : In the relations, the attribute city is functionally dependent on the composite attribute
(S#, STATUS), however, it is not fully functionally dependent on this composite attribute because,
of course, it is also functionally dependent on S # alone.
43
RDBMS FUNDAMENTALS
RDBMS FUNDAMENTALS
Teacher is not functionally dependent on course. Same with text and course.
Def.:
Given a relation R with attributes A,B,C the multi-valued dependence R.A. - - R.B. holds in R#
and only if the set of B values matching a given (A-value, C-value), pair in R depends only
on the A-value and is independent of the C-value as usual A, B and C may be composite.
This MVDS can exist only it the relation R has at least three attributes. It is common to express
both statements as a single statement.
3rd Normal Form:
A relation R is in 3NF if and only if it is in 2NF and every nonkey attribute is nontransitively
dependent on the primary key
Example:Student Information table (Roll-No,Name, Class_room_No)
Roll_No Name, Name Class_Room_No.
4th Normalization (4NF):A relation schema R is in 4NF with respect to set D of functional and multivalued dependencies
if, for all multivalued dependencies in D+ of the form X Y,
Where x subject of R and y subset of R at least one of the following holds x y is a trival
multivalued dependency.
X is a super key for schema R
45