Vous êtes sur la page 1sur 45

Published by CFS Documentation Cell

Centre for Electronics Design and Technology of India


An Autonomous Scientific Society under Department of Electronics,
Govt. of India,
New Delhi.

First Edition: 1999

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.

The thrust of the Hardware Courses at Technician and Telecommunication Equipment


Maintenance Course levels is to train the students to diagnose the faults and carry out repairs
at card level in computers, instruments, EPABX, Fax etc. and other office equipment. At
Engineer and Network Engineer levels the thrust is to train them as System Engineers to
install and supervise the Window NT, Netware and Unix Networking Systems and repair
Microcontrollers / Microprocessor based electronic applications.
An Advisory Committee comprising eminent and expert personalities from the Information
Technology field have been constituted to advise CEDTI on introduction of new courses and
revising the syllabus of existing courses to meet the changing IT needs of the trade, industry
and service sectors. The ultimate objective is to provide industry-specific quality education in
modular form to supplement the formal education.
The study material has been prepared by the CEDTI, document centre. It is based on
the vast and rich instructional experience of all the CEDTI centres. Any suggestions on the
improvement of the study material will be most welcome.

(R. S. Khandpur)
Director General (CEDTI)

TABLE OF CONTENTS
UNIT

CHAPTER NAME

PAGE NO.

INTRODUCTION TO DATABASE CONCEPTS

FILE PROCESSING SYSTEM

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

OVERALL SYSTEM ARCHITECTURE

35

13

SCHEMAS & INSTANCES

39

14

DATABASE LANGUAGES & INTERFACES

41

15

NORMALIZATION

43

PREFACE

RDBMS FUNDAMENTALS

RDBMS FUNDAMENTALS

CHAPTER - 1

INTRODUCTION TO DATABASE CONCEPTS


Database System Concepts and Architecture
Database technology has been described as one of the most rapidly growing areas of computer, business and information of science. So what is a Database system? Basically, it is
nothing more than a computer-based record keeping system.
Def:
A Data Base Management System (DBMS) is the software that manages the database and
provides facilities to the user to manage the data.
The main goal of DBMS is to provide an environment that is both convenient and efficient way
to use in retrieving and storing database information. Database systems are designed to
manage large bodies of information. The management of data involves both the definition of
structures for the storage of information and the provision of mechanism for the manipulation
of information.
However, we really face a major problem when we attempt to manage the human data using
the computer. Let us take a very simple example of an organisation that has to store the
various kinds of information regarding their employees, clients, suppliers etc. Now if we talk
only about employees that we working in different departments like production, marketing,
sales, EDP, Admin. Etc. Whose data to be store in very flexible from so that it becomes easier
while displaying with various criteria. However these files are not an ordinary file because it is
to be stored in very rigid form that CPU can manipulate the data as fast as possible. This type
of file is known as table which is really a two dimensional matrix consist of rows and columns.
An intersection of each column and row is called a cell, which is created by the DBA (Database Administrator).
A number of such cells placed in the horizontal plane is called a row or tuple. A number tuples
of equal length placed one below the other is called a table. In general table is also called a
Database which is nothing but the collection more one or more records.

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

FILE - PROCESSING SYSTEM


Before the development of the DBMS, file-processing system is used. The typical File-processing system is supported by a conventional operating system. In file-processing system
permanent records are stored in various files, and a number of application programs are
written to extract records form and add records to the appropriate files. This scheme has a
number of disadvantages, they are
Data redundancy and inconsistency
Some piece of information may be duplicated in several places ( i.e. duplicate values are
stored in files). For example the address and phone number of a particular customer may
appear in file that consists of savings account records and file that consists of checking accounts records. This redundancy leads to higher storage and access cost. In addition it may
lead to data inconsistency i.e. the various copies of the same data may no longer agree. For
example changed customer address may be reflected in savings account records but not
elsewhere in the system.
Difficulty in accessing data
Suppose the bank officers need to find out the names of all customer who live within the
citys on branch. The officer ask the data processing departments to generate such a list.
Since there is no such program to fulfill the needs, hence officer has two choice either get the
list of customers and get required information manually or write the application program.
Hence there is difficulty in accessing data.
Data Isolation
Since data is scattered in various filed may be in different formats, it is difficult to write new
application programs to retrieve the appropriate data.
Security Problems
Not every user of the database system should be able to access all the data integrity problems:

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.

Object Based Logical Model


Record Based Logical Model
Physical Model

Object Based Logical Model


These are used in describing the data at the conceptual and view level. They are provide
flexible structuring capabilities and allow data constraint to be specified explicitly.
Note: Here 6 models are there, but given below two models are important

1.
2.

Entity Relationship Model


Object Oriented Model

Entity-Relationship Model (E-R)


1.
2.
3.
4.
5.

It is a high level conceptual model


Used as a tool for database modeling and design
Involves identifying things (entities), the properties of these (attributes) and how they are
related to one another (relationship).
It is constructed in a manner independent of any implementation technique.
Acts as a definitive communication medium between the analyst and user and between
the analyst and designer.

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

Backup & Recovery


A computer system like any other mechanical or electrical device is subject of failure (like
power failure, disk crash, software errors). In case these cases information concerning the
database is lost. A DBMS must provide facilities for recovering form hardware or software
failures. The backup and recovery subsystem of the DBMS is responsible for recovery. For
example, if the computer system fails in the middle of a complex update program, the recovery
subsystem is responsible for making sure that the database is restored to the state it was in
before the program started executing. Alternatively, the recovery subsystem could ensure
that the program is resumed for the point at which it was interrupted so that its full effect is
recorded in the database.
Concurrency Control
When several users update the database concurrently, the consistency of data may no longer
be preserved. It is the responsibility of DBM to control the interaction among the concurrent
users. (not :- detail def given below).

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

Granting of authorization for data access


The granting of different types of authorization allow the database administrator to regulate
which parts of the database various users can access.
Integrity constraint specification
Integrity constraints are kept in a special system structure that is consulted by the database
manager whenever an update takes place in the system.

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
-

Last update problems


Temporary update problem
Incorrect summary problem

EX. Let there be two transactions T1 and T2 as given below:


T
Read-item (X):
X:=X-N
Write-item (Y):
Y: = Y + N :
Write item (Y):

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

OVERALL SYSTEM STRUCTURE


A database system is divided into different modules that deal with each of the responsibilities
of the overall system. Some of the functions of the database system may be provided by the
computers operating system. The design of a database system must include consideration of
the interface between the database system and the operating system. The functional
components of a database system can be broadly divided into query processor components
and storage manager components and storage manager components. The query processor
components include :
DML Compiler
Which translates DML statements in a query language into low-level instructions that the
query evaluation engine understands. In addition, the DML compiler attempts to transform a
users request into an equivalent but more efficient form, thus finding a good strategy for
executing the query.
Embedded DML precompiler
Which converts DML statements embedded in an application program to normal procedure
calls in the host language. The precompilier must interact with the DML compiler to generate
the appropriate code.
DDL Interpreter
Which interprets DDL statements and records them in a set of tables containing metadata.
Query evaluation engine
Which executes low-level instructions generated by the DML compiler.
Storage manager
The storage manager components 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 components include.
35

RDBMS FUNDAMENTALS

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 systems
failures, and that concurrent transaction executions proceed without conflicting.

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

SCHEMAS AND INSTANCES


Databases changes over time as information is stored or inserted and deleted in the database. The collection of information stored in the database at particular moment is called an
Instances of the data.
Schemas
The overall design of the database is called the database schema. Database system have
several schemas, partitioned according to the levels of abstraction that we discussed as, at
lowest level is the physical schema, at intermediate level is the local schema and at highest
level is a subschemas. In general database system supports one physical schema, one
logical schema and several subschemas.
TRIGGERS
Are a mechanism to enforce integrity.
To specify a condition and an action that is to be taken in case that condition occurs.
The condition is typically constraint violation
Triggers are fixed when the specified condition becomes true.
It is necessary to check for cycles of triggers; otherwise infinite loops may occur

39

RDBMS FUNDAMENTALS

40

RDBMS FUNDAMENTALS

CHAPTER - 14

DATABASE LANGUAGES AND INTERFACES


In Section 1.4 we discussed the variety of users supported by a DBMS. The DBMS must
provide appropriate languages and interfaces for each category of users. In this section we
discuss the types of languages and interfaces provided by a DBMS and the user categories
targeted by each interface.
DBMS Languages
Once the design of database is completed and a DBMS is chosen to implement the database,
the first order of the day is to specify conceptual and internal schemas for the database and
any mappings between the two. In DBMS where no strict separation of levels is maintained,
one language, called the data definition language (DDL), is used by the DBA and by database
designers to define both schemas. The DBMS will have a DDL compiler whose function is to
process DDL statements in order to identity description of the schema constructs and to store
the schema description in the DBMS catalogue.
In DBMS where a clear separation is maintained between the conceptual and internal levels,
the DDL is used to specify the conceptual schema only. Another language, the storage definition
language (SDL), is used to specify the internal schema. The mappings between the two
schemas may be specified in either one of these languages. For a true three-schema
architecture, we would need a third language, the view definition language (VDL), to specify
user views and their mappings to the conceptual schema. Once the database schemas are
complied and the database is populated with data, users must have some means for
manipulating the database. Typical manipulations include retrieval, insertion, deletion, and
modification of the data. The DBMS provides a data manipulation language (DML) for these
purposes.
It is common in current DBMSs not to identify the preceding types of languages as distinct;
rather, a comprehensive integrated language can be used that includes constructs for
conceptual schema definition, view definition, data manipulation, and storage definition. A
typical example is the SQL relational database language (see Chapter 7), which represents a
combination of DDL, VDL, DML and SDL, although the SDL component is now being removed
from the language.

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

1NF (First Normal Form)


A relation R is in 1 NF, if the only if all underlying domains contain atomic values only.
Example
Student Information table (Roll_No,Name, Class_Room_No)
2nd Normal Form
A relation R is in second normalform (2NF) if and only if it is in 1NF and every non-key
attribute is fully dependent on the primary key.
Example
Student Information table (Roll_No., Name, Class_Room_No)
Here Roll_No is a key attribute so Roll_No (Name, Class_Room_No)
BCNF
A relation R is in Boyce/Codd normal form (BCNF) if and only if every determinant is a candidate
key
Example
Any relation can be decomposed in a non-loss way into an equivalent collection of BCNF
relation.
FIRST (S # STATUS, CITY, P# QTY)
SECOND (S# STATUS CITY)
Relation FIRST contains three determinals : S # city , and combination (S#, p#). Of these,
only (S#,P#) is a candidate key, Hence, FIRST is no BCNF, Sincerely, SECOND is not BCNF
because the determinate city is not a candidate key.
Multi-valued dependencies
(MVDS) are a centralization of FDS. There are two MVDS in relation CTx. Not CTx is a table
define below CTx (Course, Teacher, Text)
Ctx. Course - - CTx. Teacher
Ctx. Course - - CTx. Text
(The MVD statement R.A. - - R.B. is read as attribute R.B. is muti-dependent Y on attribute
R.A. or equivalently, attribute R.B.)
44

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

Vous aimerez peut-être aussi