Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 3

Master of Computer Application (MCA) – Semester 2

MC0067 – Database Management System


(DBMS and Oracle 9i) – 4 Credits
(Book ID: B0716 & B0717)
Assignment Set – 1 (40 Marks)

Book ID: B0716

Q.1 Explain the functions and advantages of a DBMS over a traditional file system.

Ans : The functions performed by a typical DBMS are the following:


• Data Definition – The DBMS provides functions to define the structure of the data in the application.
These include defining and modifying the record structure, the type and size of fields and the various
constraints/conditions to be satisfied by the data in each field.
• Data Manipulation – Once the data structure is defined, data needs to be inserted, modified or deleted.
The functions which perform these operations are also part of the DBMS.
• Data Security & Integrity – The DBMS contains functions which handle the security and integrity of data
in the application. These can be easily invoked by the application and hence the application programmer
need not code these functions in his/her programs.
• Data Recovery & Concurrency – Recovery of data after a system failure and concurrent access of records
by multiple users are also handled by the DBMS.
• Data Dictionary Maintenance – Maintaining the data Dictionary which contains the data definition of the
application is also one of the functions of a DBMS.
• Performance – Optimizing the performance of the queries is one of the important functions of a DBMS.
Hence the DBMS has a set of programs forming the Query Optimizer which evaluates the different
implementations of a query and chooses the best among them.

Q. 2 Describe indexing and clustering techniques with relevant real time examples.
Ans : Clustering – If the page containing the requested record is already in the memory, retrieval from the disk is not
necessary. In such a situation, time taken for the whole operation will be less.Thus, if records which are frequently used
together are placed physically together, more records will be in the same page. Hence the number of pages to be retrieved
will be less and this reduces the number of disk accesses which kin turn gives a better performance.

This method of storing logically related records, physically together is called clustering.
Example - Consider CUSTOMER table as shown below.

Cust ID Cust Name Cust City ………..


10001 Raj Delhi ………..
10002 …. …. ………..
10003 …. …. ………..
10004 …. …. ………..
…. … … ….
… … … ….

If queries retrieving Customers with consecutive Cust_IDs frequently occur in the application, clustering based on Cust_ID
will help improving the performance of these queries. This can be explained as follows.

Assume that the Customer record size is 128 bytes and the typical size of a page retrieved by the File Manager is 1 kb (1024
bytes).
If there is no clustering, it can be assumed that the Customer records are stored at random physical locations. In the worst-
case scenario, each record may be placed in a different page. Hence a query to retrieve 100 records with consecutive
Cust_Ids (say ,10001 to 10100), will require 100 pages to be accessed which in turn translated to 100 disk accesses.
Indexing – Indexing is another common method for making retrievals faster.
Consider the example of CUSTOMER table used above. The following query is based on Customer’s City.

“Retrieve the records of all customers who reside in Delhi”

Here a sequential search on the CUSTOMER table has to be carried out and all records with the value ‘Delhi’ in the
Cust_City field have to be retrieved. The time taken for this operation depends on the number of pages to be accessed. If the
records are randomly stored, the page accesses depends on the volume of data. If the records are randomly stored, the page
accesses depends on the volume of data. If the records are stored physically together, the number of pages depends on the
size of each record also.

If such queries based on Cust_City field are very frequent in the application, steps can be taken to improve the performance
of these queries. Creating an Index on Cust_City is one such method. This results in the scenario as shown below.

Indexing
City(Index)
City CustN Name City
Mumbai o
Mumbai Q.3 Describe various 001 Shah Mumbai
Kolkata 002 Srinivasa Chennai
integrity rules with a
Delhi n
Chennai relevant example. 003 Gupta Delhi
Ans : Integrity Rules 004 Banerjee Kolkata
005 Apte Mumbai
– The following are the integrity rules to be satisfied by 006 Krishnan Chennai
any relation.
• No Component of the Primary Key can be null.
• The Database must not contain any unmatched Foreign Key values. This is called the referential integrity rule.
Unlike the case of Primary keys , there is no integrity rule saying that no component of the foreign key can be null. This can
be logically explained with the help of the following example:
Consider the relations Employee and account as given below:
Employee
Emp# EmpName EmpCity EmpAcc#
X101 Manzar Siliguri 120001
X102 Shanawaj Mumbai 120002
X103 Ranjana Delhi Null
X104 Begum Pune 120003

Account
Acc# OpenDate BalAmt
120001 30-08-98 500
120002 29-10-98 1200
120003 01-01-99 3000
120004 04-03-99 500
EmpAcc# in Employee relation is a foreign key creating reference from Employee to Account. Here, a Null value in
EmpAcc# attribute is logically possible if an Employee does not have a bank account. If the business rules allow an
employee to exist in the system without opening an account, a Null value can be allowed for EmpAcc# in Employee relation.

In the case example given, Cust# in Ord_Aug cannot accept Null if the business rule insists that the Customer No. Needs to
be stored for every order placed.

Q.4 Explain the three-level architecture of a DBMS with a labeled diagram.


Ans :

You might also like