You are on page 1of 14

Database Management System

A Laboratory Manual for

DATABASE MANAGEMENT AND SYSTEM

Semester VII

Department of Computer Science & Engineering

JAWAHARLAL DARDA INSTITUTE OF ENGINEERING


& TECHNOLOGY
YAVATMAL - 445001, (M.S.), INDIA

Department of Computer Science & Engineering.

Database Management System

JAWAHARLAL DARDA INSTITUTE OF ENGINEERING


& TECHNOLOGY

Department of Computer Science and Engineering

CERTIFICATE
This is to certify that Mr. / Ms. _______________________________
Roll No. _________ of Seven semester has satisfactory completed the course
experiments in the practical prescribed by Sant Gadge Baba Amravati
University, Amravati course in the Database Management And System
laboratory in the year 2011 to 2012 as per the prescribed curriculum.

Sign of Faculty

Department of Computer Science & Engineering.

Head of the Department

ii

Database Management System

LEARNING OVERVIEW
Importance of Database Management System:
Database management system is the system of computer software that is
aimed to provide a managing tool for maintaining the data, through various data
models. If you look over the large companies or even the smaller ones, can you
believe that all of them are maintaining the manual registers for the collection of data?
Obviously not! The invention of computer and the software has made it easy to
manage the data of all types in the database management system and then having a
direct access to data more quickly and easily than the manual system. For example, if
you go to your doctor for a routinely check up, he will have a record of the last time
you visited him. This shows that for each patient he will have the same record and this
is what the database management system is supposed to do.
From an end user of database management very important uses are as:
1.

Saves time, and thereby increases productivity & profits, by making it easier

to retrieve data as needed.


2. With database management it makes backing up of vital data much easier
3. Being organized
4. Quick access to data
5.Statisticalview
6.Convenientlylinked
7. No unnecessary data
Objectives of Database Management Systems:
1. DBMS give multi-user access
2. Give good security to database.
3. Give full control to Data
4. Gives better hope of porting the code to other DBMS products. (Good compatibility).
5. Platform independent.
6. Support online documentation
7. Keep and maintain proper backups.
8. Concurrency control.
9. crash recovery
10. Complex query support

Department of Computer Science & Engineering.

iii

Database Management System

Learning Structure of Database Management System:


What is Database Management System:
A database provides for the storing and control of business data. It is independent
from (but not separate from the processing requirements of) one or more applications.
If properly designed and implemented, the database should provide a single consistent
view of the business data, so that it can be centrally controlled and managed.
One way of describing a logical view of this collection of data is to use an entity
relationship model. The database records details (attributes) of particular items
(entities) and the relationships between the different types of entities. For example, for
the stock control area of an application, you would have Parts, Purchase Orders,
Customers, and Customer Orders (entities). Each entity would have attributesthe Part
would have a Part No, Name, Unit Price, Unit Quantity, and so on. These entities
would also have relationships between them, for example a Customer would be
related to orders placed, which would be related to the part that had been ordered, and
so on. Figure 1 illustrates an entity relationship model.
Figure 1. Entities, attributes, and relationships

Structures in Database Management System:

Department of Computer Science & Engineering.

iv

Database Management System


A database is a logical grouping of data. It contains a set of related table spaces and index
spaces. Typically, a database contains all the data that is associated with one application or
with a group of related applications. You could have a
payroll database or an inventory database, for example.
Table: A table is a logical structure made up of rows and columns. Rows have no fixed order,
so if you retrieve data you might need to sort the data. The order of the columns is the order
specified when the table was created by the database administrator. At the intersection of
every column and row is a specific data item called a value, or, more precisely, an atomic
value. A table is named with a high-level qualifier of the owner's user ID followed by the
table name, for example TEST.DEPT or PROD.DEPT. There are three types of tables:

A base table that is created and holds persistent data

A temporary table that stores intermediate query results

A results table that is returned when you query tables.

Figure 1. Example of a DB2 table (department table)

Indexes
An index is an ordered set of pointers to rows of a table. Unlike the rows of a table
that are not in a specific order, an index must always be maintained in order by DB2.
An index is used for two purposes:

For performance, to retrieve data values more quickly

For uniqueness. Creating an index automatically creates the index space, the
data set that contains the index.

Department of Computer Science & Engineering.

Database Management System


Keys
A key is one or more columns that are identified as such in the creation of a table or
index, or in the definition of referential integrity.
Primary key
A table can only have one primary key because it defines the entity. There are two
requirements for a primary key:
1. It must have a value, that is, it cannot be null.
2. It must be unique, that is, it must have a unique index defined on it.
Unique key
We already know that a primary key must be unique, but it is possible to have more
than one unique key in a table. In our EMP table example, the employee number is
defined as the primary key and is therefore unique.
If we also had a social security value in our table, hopefully that value would be
unique. To guarantee this, you could create a unique index on the social security
column.
Foreign key
A foreign key is a key that is specified in a referential integrity constraint to make its
existence dependent on a primary or unique key (parent key) in another table.
The example given is that of an employee's work department number relating to the
primary key defined on the department number in the DEPT table. This constraint is
part of the definition of the table.

Designing Of Database Management system:

Department of Computer Science & Engineering.

vi

Database Management System


The process of database design, in its simplest form, is the structuring of the data
elements for the various applications, in such an order that (1) each data element is
readily available by the various applications, now and in the foreseeable future, (2)
the data elements are efficiently stored, and (3) controlled access is enforced for those
data elements with specific security requirements.A number of different models for
databases have been developed over the years (such as hierarchical, relational, or
object) so that there is no consistent vocabulary for describing the concepts involved.
Entities
A database contains information about entities. An entity is something that:

Can be uniquely defined.

We might collect substantial information about, now or in the future.


In practice, this definition is limited to the context of the applications and business
under consideration. Examples of entities are parts, projects, orders, customers,
trucks, etc. It should be clear that defining entities is a major step in the database
design process. The information we store in databases about entities is described by
data attributes.
Data attributes
A data attribute is a unit of information that specifies a fact about an entity. For
example, suppose the entity is a part. Name=Washer, Color=Green, and Weight=143
are three facts about that part. Thus these are three data attributes.
A data attribute has a name and a value. A data attribute name tells the kind of fact
being recorded; the value is the fact itself. In this example, Name, Color, and Weight
are data attribute names; while Washer, Green and 143 are values. A value must be
associated with a name to have a meaning.
An occurrence is the value of a data attribute for a particular entity. An attribute is
always dependent on an entity. It has no meaning by itself. Depending on its usage, an
entity can be described by one single data attribute, or more. Ideally, an entity should
be uniquely defined by one single data attribute, for example, the order number of an
order. Such a data attribute is called the key of the entity. The key serves as the

Department of Computer Science & Engineering.

vii

Database Management System


identification of a particular entity occurrence, and is a special attribute of the entity.
Keys are not always unique. Entities with equal key values are called synonyms.
Entity relationships
The entities identified will also have connections between them, called relationships.
For example, an order might be for a number of parts. Again these relationships only
have meaning within the context of the application and business. These relationships
can be one-to-one (that is, one occurrence of an entity relates to a single occurrence of
another entity), one-to-many (one occurrence of an entity relates to many occurrences
of another entity), or many-to-many (many occurrences of one entity have a
relationship with many occurrences of another entity).
Relationships can also be recursive, that is, an entity can have a relationship with
other occurrences of the same entity. For example a part, say a fastener, may consist
of several other parts: bolt, nut, and washer.
Application functions
Data itself is not the ultimate goal of a database management system. It is the
application processing performed on the data that is important. The best way to
represent that processing is to take the smallest application unit representing a user
interacting with the databasefor example, one single order, one part's inventory
status. In the following sections we call this an application function. Functions are
processed by application programs. In a batch system, large numbers of functions are
accumulated into a single program (that is, all orders of a day), then processed against
the database with a single scheduling of the desired application program. In the online
system, just one or two functions may be grouped together into a single program to
provide one iteration with a user.
Although functions are always distinguishable, even in batch, some people prefer to
talk about programs rather than functions. But a clear understanding of functions is
mandatory for good design, especially in a DB environment. Once you have identified
the functional requirements of the application, you can decide how to best implement
them as programs using CICS or IMS. The function is, in some way, the individual

Department of Computer Science & Engineering.

viii

Database Management System


use of the application by a particular user. As such, it is the focal point of the DB
system.
Access paths:
Each function bears in its input some kind of identification with respect to the entities
used (for example, the part number when accessing a Parts database). These are
referred to as the access paths of that function. In general, functions require random
access, although for performance reasons sequential access is sometimes used. This is
particularly true if the functions are batched, and if they are numerous relative to the
database size, or if information is needed from most database records. For efficient
random access, each access path should utilize the entities key.

GUIDELINES FOR FACULTIES:


Faculties shall discuss the following points with students before start of practical of the
subject.

Department of Computer Science & Engineering.

ix

Database Management System


1. Learning Overview:
To develop better understanding of importance of the subject. To know related
skills to be developed such as Intellectual skills and Motor skills.
2. Learning Structure:
In this, topics and sub topics are organized in systemic way so that ultimate
purpose of the subject is achieved. This is arranged in the form of facts, concept,
principle, procedure, application and problem.
3.

Know your Laboratory Work:


To understand the layout of the laboratory, specifications of Equipment/

Instruments /Materials, procedure, working in groups, planning time etc. Also to


know total amount of work to be done in the laboratory.
a. Faculty shall ensure that required equipments are in working condition before
start of Experiment; also keep operating instruction manual available.
4.
Explain prior concepts to the students before starting of each experiment.
5.
Involve students activity at the time of conduct of each experiment.
6.
While taking reading / observation each student (from a batch of 20 students)
shall be given a chance to perform or observe the experiment.
7.
List of questions is given at the end of each experiment. Faculty shall instruct
the students to attempt al questions given at the end of each experiment / exercise.
Faculty shall ensure that each student writes the answer to the allotted questions in the
laboratory manual after performance is over.
8.
If the experimental set up has variations in the specifications of the equipment,
the faculties are advised to make the necessary changes, wherever needed.
9.
Faculty should ensure that the respective skills and competencies are
developed in the students after the completion of the practical exercise.
10.
Faculty is expected to share the skills and competencies to be developed in the
students.
11.
Faculty may provide additional knowledge and skills to the students even
though not covered in the manual but are expected from the students by the industries.
12.
Faculty shall ensure that industrial visits recommended in the manual are
covered.
13.
Faculty may suggest the students to refer additional related literature of the
Technical papers / Reference books / Seminar proceedings, etc.
14.
During assessment faculty is expected to ask questions to the students to tap
their achievements regarding related knowledge and skills so that students can
prepare.

Department of Computer Science & Engineering.

Database Management System

INSTRUCTIONS FOR STUDENTS


Students shall read the points given below for understanding the theoretical concepts
and practical applications:
1. Listen carefully to the lectures given by faculty about importance of subject,
curriculum philosophy, learning structure, skills to be developed, information about
equipment, instruments, procedure, method of continuous assessment, tentative plan
of work in the laboratory and total amount of work to be done in a semester.
2. Students shall undergo study visit of the laboratory for types of equipment,
instruments, material to be used, before performing experiments.
3. Read the write up of each experiment to be performed, a day in advance.
4. Organize the work in the group and make a record of all observations.

Department of Computer Science & Engineering.

xi

Database Management System


5. Understand the purpose of experiment and its practical implications.
6. Write the answers of the questions allotted by the faculty during practical hours if
possible or afterwards, but immediately.
7. Students should not hesitate to ask any difficulty faced during conduct of
practical/exercise.
8. The students shall study all the questions given in the laboratory manual and practice
to write the answers to these questions.
9. Students shall develop maintenance skills as expected by the industries.
10. Students shall develop the habit of pocket discussion/group discussion related to the
experiments/exercises so that exchange of knowledge/skills could take place.
11. Student shall attempt to develop related hands-on-skills and gain confidence.
12. Students shall focus on development of skills rather than theoretical or codified
knowledge.
13. Students shall visit the area nearby workshop, workstation, industries, laboratories,
technical exhibitions, trade fair etc. even not included in the lab manual. In short,
students should have exposure to the area of work right in the student hood.
14. Student shall insist for the completion of recommended laboratory work, industrial
visits, answers to the given questions etc.
15. Students shall develop the habit of evolving more ideas, innovations, skills etc. those
included in the scope of the manual.
16. Student shall refer technical magazines, proceedings of the seminars, refer websites
related to the scope of the subjects and update their knowledge and skills.
17. Students should develop the habit of not to depend totally on faculties but to develop
self learning techniques.
18. Students should develop the habit to react with the faculty without hesitation with
respect to the academics involved.
19. Students should develop habit to submit the practical, exercise continuously and
progressively on the scheduled dates and should get the assessment done.
20. Students should be well prepared while submitting the write up of the exercise, this
will develop the continuity of the studies and he will not be over loaded at the end of
the term.

Department of Computer Science & Engineering.

xii

Database Management System

LIST OF EXPERIMENTS AND RECORD OF PROGRESSIVE ASSESSMENT


Sr.

Name of Experiment

No.
1.

Consider

the

employee

Page

Date

of Date

no.

performance

database.

Where the primaries are underlined &


write the queries using following
clauses & also retrieve the data from

2.

the given database.


Consider the previous database &
perform the different Join operations
which are as follows:

Department of Computer Science & Engineering.

xiii

of Assessment

submission

mark

Sign
Faculty

of

Database Management System


I) Inner Join

3.

II) Outer Join

III)

Right Outer Join IV) Full Outer Join


Write a query to perform the different
Set operation Which are as fallows:

I)

Union II) Intersect

4.

III) Except/Minus
Consider above database and perform

5.
6.

aggregate functions
Write an assertion for all the bank DB
Write a. SQL trigger to carry out

7..

Operations
Consider the above Bank Database
and write SQL queries for the views.

8.

Write a program for generating,


altering &removing Sequence

9.

write a program

for control of

10

database access using grant and revoke


Mini Project Using Oracle 9i & VB6

Department of Computer Science & Engineering.

xiv

You might also like