DBMS
DBMS
Bhavana Sangamnerkar
M.Sc. (Comp. Prog.), PGDCA
H.O.D.
Revised by: Shiv Kishore Sharma
Information Technology
Biyani Girls College, Jaipur
2
Published by :
Think Tanks
Biyani Group of Colleges
ISBN : 978-93-81254-43-1
Edition : 2011
Price :
on that may have crept in is not intentional. It may be taken note of that neither the publisher nor the author will be responsible for any da
Preface
I am glad to present this book, especially designed to serve the needs of the
students. The book has been written keeping in mind the general weakness in
understanding the fundamental concepts of the topics. The book is self-explanatory
and adopts the “Teach Yourself” style. It is based on question-answer pattern. The
language of book is quite easy and understandable based on scientific approach.
Any further improvement in the contents of the book by making corrections,
omission and inclusion is keen to be achieved based on suggestions from the
readers for which the author shall be obliged.
I acknowledge special thanks to Mr. Rajeev Biyani, Chairman & Dr. Sanjay
Biyani, Director (Acad.) Biyani Group of Colleges, who are the backbones and main
concept provider and also have been constant source of motivation throughout this
Endeavour. They played an active role in coordinating the various stages of this
Endeavour and spearheaded the publishing work.
I look forward to receiving valuable suggestions from professors of various
educational institutions, other faculty members and students for improvement of the
quality of the book. The reader may feel free to send in their comments and
suggestions to the under mentioned address.
Note: A feedback form is enclosed along with think tank. Kindly fill the
feedback form and submit it at the time of submitting to books of
library, else NOC from Library will not be given.
Author
Syllabus
M.Sc.-IT (1st Sem.)
Database Management System
Object Oriented Database [Only Basic Information about OODBMS and ORDBMS]
Database Query Languages [Basic Retrieval Capability, Retrieval and Explosion, Update
Commands, QBEI, Client/ Server Design]
Standard Query Language [Basic SQL Query, Nested Queries Aggregate Operators, Null
Values, Embedded SQL, Cursor, Dynamic SQL Query Optimization [Query Evaluation
Plans, Pipelined Evaluation, Iterator Interface for Operators and Access Methods, Relational
Query Optimizer]
Tuning [Tuning Indexes, Tuning Queries and Views, Tuning the Conceptual Schema,
DBMS Benchmarking]
Security [Access Control, Discretionary and Mandatory Access Control, Encryption] and
Implementation.
Databases and Tools : MS-Access SQL Visual Basic ORACLE [Wherever required these
tools should be used].
□□□
Content
S. No. Name of Topic
1. Data and Information
1.1 Basic Concepts
1.2 Problems of Early Information Systems
1.3 Advantages of DBMS
2. Database Architecture
2.1 Theory of Abstraction
2.2 Level of Architectures
2.3 Types of Users
2.4 Centralized and Distributed Databases
3. Data Models
3.1 Hierarchical Model
3.2 Relational Model
3.3 Network Model
4. Relational Algebra & Relational Calculus
4.1 Introduction
4.2 Basic Retrieval Capacity
5. Concept of Network
5.1 Concept of Network
5.2 DBTG
5.3 DBA Schema Declaration
6. Types of DBMS
6.1 Object Oriented DBMS
6.2 Object Relational DBMS
7. Data and Query Processing
7.1 Basic Retrieval Capacity
7.2 Query Language
7.3 Query Processing
7.4 Client/Server Design
Chapter-1
Integrity Problems :
Data may be required to satisfy constraints.
E.g. no account balance below $25.00.
Again, difficult to enforce or to change constraints with
the file-processing approach.
Above all problems lead to the development of Database Management
Systems.
Advantages :
An organized and comprehensiveness of recording the result of the
firms activities.
Components include :
Users
Application Interface
Application Programs Query Database Scheme
File Manager
Data Files
□□□
Chapter-2
Database Architecture
Application Internal
Programmers Level Level
Physical Level : The lowest level of abstraction describes how the data is
actually stored. The physical level describes complex low-level data
structures in detail.
Logical Level : The next higher level of abstraction describes what data are
stored in the database, and what relationships exist among those data. The
logical level thus describes an entire database in terms of a small number of
relatively simple structures. Although implementation of the simple
structures at the logical level may involve complex physical level structures,
the user of the logical level does not need to be aware of this complexity.
Database administrators, who must decide what information to keep in a
database, use the logical level of abstraction.
View Level : The highest level of abstraction describes only part of the entire
database. Even though the logical level uses simpler structures, complexity
Q.3 How will you define different Database Users in Database Management
System?
Ans.: The Database Users fall into several categories :
Naive Users are unsophisticated users who interact with the system by
using permanent application programs (e.g. automated teller
machine).
Chapter-3
Data Models
street
b) Object-Oriented Model :
The object-oriented model is based on a collection of objects,
like the E-R model.
The only way in which one object can access the data of
another object is by invoking the method of that other
object.
556 100000
BANK
556100000 647105366
The relational model does not use pointers or links, but relates records
by the values they contain. This allows a formal mathematical
foundation to be defined.
(iii) Physical Data Models :
a) Are used to describe data at the lowest level.
b) Very few models, e.g.
Unifying model
Frame memory
Constraints Description
□□□
Chapter-4
Q.2 What do you mean by Database Manager and explain its responsibilities
for DBMS.
Ans.: Database Manager :
a) 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.
b) Databases typically require lots of storage space (gigabytes). This must
be stored on disks. Data is moved between disk and main memory
(MM) as needed.
c) The goal of the database system is to simplify and facilitate access to
data. Performance is important. Views provide simplification.
d) So the database manager module is responsible for :
As in any algebra, some operators are primitive and the others, being
definable in terms of the primitive ones, are derived. It is useful if the choice
of primitive operators parallels the usual choice of primitive logical operators.
Although it is well known that the usual choice in logic of AND, OR and
NOT is somewhat arbitrary, Codd made a similar arbitrary choice for his
algebra.
The six primitive operators of Codd's algebra are the selection, the projection,
the Cartesian product (also called the cross product or cross join), the set union,
the set difference, and the rename. (Actually, Codd omitted the rename, but the
compelling case for its inclusion was shown by the inventors of ISBL.) These
six operators are fundamental in the sense that none of them can be omitted
without losing expressive power. Many other operators have been defined in
terms of these six. Among the most important are set intersection, division,
and the natural join. In fact ISBL made a compelling case for replacing the
Cartesian product by the natural join, of which the Cartesian product is a
degenerate case.
Altogether, the operators of relational algebra have identical expressive
power to that of domain relational calculus or tuple relational calculus.
However, for the reasons given in the Introduction above, relational algebra
has strictly less expressive power than that of first-order predicate calculus
without function symbols. Relational algebra actually corresponds to a subset
of first-order logic that is Horn clauses without recursion and negation.
The Relational Algebra is a procedural query language.
Set-intersection
Natural join
Division
Assignment
customer_name loan-number
Adams L-16
Curry L-93
Hayes L-15
Jackson L-14
Jones L-17
Smith L-11
Smith L-23
Williams L-17
Fundamental Operations :
(i) The Select Operation :
Select selects tuples that satisfy a given predicate. Select is denoted by
a lowercase Greek sigma (), with the predicate appearing as a
subscript. The argument relation is given in parentheses following the
.
For example, to select tuples (rows) of the borrow relation where the
branch is ``SFU'', we would write
bname = “SFU”(borrow)
Let Figure be the borrow and branch relations in the banking example :
ename banker
Hayes Jones
Johnson Johnson
Figure : The client Relation
Suppose there is one more relation, client, shown in Figure, with the
scheme
Client_scheme = (ename, banker)
we might write
ename = banker(client)
to find clients who have the same name as their banker.
(ii) The Project Operation :
Project copies its argument relation for the specified attributes only.
Since a relation is a set, duplicate rows are eliminated.
Projection is denoted by the Greek capital letter pi ( ). The attributes
to be copied appear as subscripts.
For example, to obtain a relation showing customers and branches, but
ignoring amount and loan#, we write
∏bname, ename(borrow)
We write ρz(r)
to get the relation r under the name of z.
If we use this to rename one of the two customer relations we are
using, the ambiguities will disappear.
∏customer . ename (cust2 . street = customer . street cust2 . ecity = customer . ecity
This resulting relation contains all balances except the largest one.
Now we can finish our query by taking the set difference:
∏balance(deposit) ― ∏deposit . balance ( deposit . balance < d. balance (deposit x
ρd(deposit)))
Figure shows the result.
(a) balance (b) balance
400 1300
500 900
700
Figure 1 : Find the largest account balance in the bank
Formal Definition of Relational Algebra :
(i) A basic expression consists of either
o A relation in the database.
o A constant relation.
(ii) General expressions are formed out of smaller subexpressions using
o P(E1) select (p a predicate)
o E1 U E2 union
o E1 ― E2 set difference
o E1 x E2 Cartesian product
Additional Operations :
(i) Additional operations are defined in terms of the fundamental
operations. They do not add power to the algebra, but are useful to
simplify common queries.
(ii) The Set Intersection Operation
Set intersection is denoted by , and returns a relation that contains
tuples that are in both of its argument relations.
It does not add any power as
r ∩ s = r ― (r ― s)
To find all customers having both a loan and an account at the SFU
branch, we write
∏ename(bname = “SFU”(borrow)) ∩ ∏ename(bname = “SFU”(deposit))
(iii) The Natural Join Operation :
Often we want to simplify queries on a Cartesian product.
For example, to find all customers having a loan at the bank and the
cities in which they live, we need borrow and customer relations :
∏borrow . ename , ecity (borrow . ename = customer . ename (borrow x customer))
ename ecity
Smith Burnaby
Hayes Burnaby
Jones Vancouver
Figure : Joining borrow and customer relations
We can now make a more formal definition of natural join.
o Consider R and S to be sets of attributes.
o We denote attributes appearing in both relations by R ∩ S.
o We denote attributes in either or both relations by R U S.
o Consider two relations r(R) and s(S).
o The natural join of r and s, denoted by r x s is a relation on
scheme R U S.
o It is a projection onto R U S of a selection on r x s where the
predicate requires r . A = s . A for each attribute A in R ∩ S.
Formally,
r x s = ∏R U S(r.A1 = s.A1 r.A2 = s.A2..................................r.An = s.An (r x s))
where R ∩ S = { A1 , A2 ,_____, An }
To find the assets and names of all branches which have depositors
living in Stamford, we need customer, deposit and branch relations :
∏bname , assets(ecity = “Stamford” (customer x deposit x branch))
Note that x is associative.
To find all customers who have both an account and a loan at the SFU
branch:
∏ename (bname = “SFU” (borrow x deposit))
tr[R - S] = ts[R - S]
This gives us all attributes, but suppose we only want the customer names.
(We would use project in the algebra.)
We need to write an expression for a relation on scheme (cname).
{ t │ t Є borrow ( t[ename] = s[ename] s[amount] > 1200 )}
In English, we may read this equation as ``the set of all tuples t such that
there exists a tuple in the relation borrow for which the values of t and s for
the cname attribute are equal, and the value of s for the amount attribute is
greater than 1200.''
The notation t Є r(Q(t)) means ``there exists a tuple t in relation r such that
predicate Q(t) is true''.
How did we get the above expression? We needed tuples on scheme cname
such that there were tuples in borrow pertaining to that customer name with
amount attribute > 1200.
The tuples get the scheme cname implicitly as that is the only attribute is
mentioned with.
Let's look at a more complex example.
Find all customers having a loan from the SFU branch, and the the cities in
which they live:
{ t │ t Є borrow ( t[ename] = s[ename] s[amount] = “SFU” )}
{ u Є customer ( u[ename] = s[ename] t[ecity] = u[ecity] )}
In English, we might read this as ``the set of all (cname,ccity) tuples for which
cname is a borrower at the SFU branch, and ccity is the city of cname''.
Tuple variable s ensures that the customer is a borrower at the SFU branch.
Tuple variable u is restricted to pertain to the same customer as s, and also
ensures that ccity is the city of the customer.
The logical connectives (AND) and (OR) are allowed, as well as
(negation).
We also use the existential quantifier and the universal quantifier .
Some more examples :
(i) Find all customers having a loan, an account, or both at the SFU branch
:
o s[x] u[y], where and are tuple variables, and x and y are
attributes, and is a comparison operator (<, , =, , >, ).
o P1 P2 = ( P1 V P2)
o t Є r(P(t)) = t Є r( P(t))
o P1 => P2 = P1 V P2
The Domain Relational Calculus :
Domain variables take on values from an attribute's domain, rather than
values for an entire tuple. Formal Definitions
(i) An expression is of the form
{ < x1, x2 , . . . , xn > │ P (x1, x2 , . . . , xn )}
where the xi1 1 i n1 represent domain variables, and P is a
formula.
(ii) An atom in the domain relational calculus is of the following forms
o < x1, x2 , . . . , xn > Є r where r is a relation on n attributes, and xi1
1 i n1, are domain variables or constants.
o x c, where c is a constant.
(iii) Formulae are built up from atoms using the following rules :
o An atom is a formula.
o If is a formula, then so are P and (P).
o If P1 and P2 are formulae, then so are P1 P2, P1 V P2 and P1
P2.
Example Queries :
(i) Find branch name, loan number, customer name and amount for loans
of over $1200.
{ < b1 I1 c1 a > │ b1 I1 c1 a Є borrow a > 1200 }
(ii) Find all customers who have a loan for an amount > than $1200.
{ < c > │ b1 I1 a (< b1 I1 c1 a > Є borrow a > 1200 )}
(iv) Find all customers having a loan from the SFU branch, and the city in
which they live.
{ < c1 x > │ b1 I1 a (< b1 I1 c1 a > Є borrow
b = “SFU” > y ( c1 y1 x > Є customer ))}
(v) Find all customers having a loan, an account or both at the SFU branch.
{ < c > │ b1 I1 a (< b1 I1 c1 a > Є borrow b = “SFU”)
V b1 a1 n (< b1 a1 c1 a > Є deposit b = “SFU”)}
(vi) Find all customers who have an account at all branches located in
Brooklyn.
{<c>│ x1 y1 z ( ( < x1 y1 z > Є branch)
z ”Brooklyn” b1 a1 n ( a1 n (< x1 a1 c1 n > Є deposit )))}
If you find this example difficult to understand, try rewriting this
expression using implication, as in the tuple relational calculus
example. Here's my attempt:
{ < cn > │ bn1 as1 bc ( ( < bn1 as1 bc > Є branch)
bc ”Brooklyn”) => an1 ba (< cn1 an1 ba1 bn > Є deposit )))}
I've used two letter variable names to get away from the problem of
having to remember what x stands for.
□□□
Chapter-5
Concept of Network
owner and one or more instances of the record type corresponding to entity
E2 as the member. If a relationship has attributes, unless the attributes can be
assigned to the member record type, they have to be maintained in a separate
logical record type created for this purpose. The introduction of this
additional record type requires that the original set be converted into two
symmetrical sets, with the record corresponding to the attributes of the
relationship as the member in both the sets and the records corresponding to
the entities as the owners.
Each many-to-many relationship is handled by introducing a new record type
to represent the relationship wherein the attributes, if any, of the relationship
are stored. We then create two symmetrical 1:M sets with the member in each
of the sets being the newly introduced record type.
In the network model, the relationships as well as the navigation through the
database are predefined at database creation time.
Q.4 What do you mean by Database Administrator and explain its duties? Also
define DBA Schema.
Ans.: Database Administrator :
The Database Administrator is a person having central control over data and
programs accessing that data. Duties of the database administrator include :
□□□
Chapter-6
Types of Databases
Improved availability
Improved reliability
Improved performance
Modular growth
Complexity
Cost
Security
Lack of standards
Lack of experience
Data from the other sites may have different hardware, different
DBMS products and combination of different hardware and DBMS
products.
The task for locating those data and performing any necessary
translation are the abilities of heterogeneous DDBMS.
Chapter-7
Q.1 Discuss the factors which determines the role of Data Processing?
Ans.: It is important to understand information system in the context of their use in
information processing. Which is also called data processing. We can define
data or information processing as the processing of data to make it more
usable and meaningful, Thus transforming it into information. The factors
which determines the role of data processing are as follows -
Data versus Information :
Data Information
Meaning: Plain facts When data are
processed,
organized,
structured or
presented in a given
context so as to make
them useful, they are
called Information.
Data are plain facts. The word "data" is plural for "datum." When data are
processed, organized, structured or presented in a given context so as to
make them useful, they are called Information.
It is not enough to have data (such as statistics on the economy). Data
themselves are fairly useless. But when these data are interpreted and
processed to determine its true meaning, they becomes useful and can be
called Information.
The MIS versus The Data Processing System :
Data Processing Systems, or DP Systems, are concerned with transaction
handling and record-keeping, usually for a particular functional area.
Here are a few differences between an MIS and a DPS :
COURSE (course#,course-name,instructor)
Genral strategies for Query processing:
Query Representation :
Query posed by users are not in a form which is convenient for internal
system use .So query procesdsors tranform it into thre form of relational
calculus ,relational algebra, Object graph,operator graph or tables.
Operator Graph :
An operator graph despicts how a sequence of operation can be performed. In
operator graph s, operations are represented by nodes and the flow of data is
shown by directed edges.
Example Query : ―List names students registered in database course‖
Πstd-name(σcourse-name=‖database‘(STUDENT |X| REGISTRATION|X|
COURSE)
Steps in Query Processing :
(i) Convert to a Standard Strate Point : We can use relational algebric
form and operator graph as the starting point.
We can assume that the query expression is in conjunctive normal
form.
(ii) Transform the Query : The query is transformed by replasing
expression in the query with those that are likely to enhance
performance.
(iii) Simplify the Query : The query is simplified by removing redundant
and useless operations.
(iv) Prepare Alternative Access Plans : The alternative access plan
indicates the order in which the various operations will be performed
and the cost of such plan.The cost is depends upon whether or the not
the relations. Are sorted and the presence or absence of indexes. The
optional aceess plan is chosen.
Genral Processing Straitegies :
(i) Perform selection as early as possible.
(ii) Combine a number of unary operations.
(iii) Convert the cartesian product with a certain subsequent selection into
join.
□□□
Chapter-8
History :
During the 1970s, a group at IBM's San Jose research center developed the
System R relational database management system, based on the model
introduced by Edgar F. Codd in his influential paper, A Relational Model of
Data for Large Shared Data Banks.[3] Donald D. Chamberlin and Raymond F.
Boyce of IBM subsequently created the Structured English Query Language
(SEQUEL) to manipulate and manage data stored in System R. [4] The
acronym SEQUEL was later changed to SQL because "SEQUEL" was a
trademark of the UK-based Hawker Siddeley aircraft company.
The first non-commercial non-SQL RDBMS, Ingres, was developed in 1974 at
the U.C. Berkeley. Ingres implemented a query language known as QUEL,
which was later supplanted in the marketplace by SQL.
In the late 1970s, Relational Software, Inc. (now Oracle Corporation) saw the
potential of the concepts described by Codd, Chamberlin, and Boyce and
developed their own SQL-based RDBMS with aspirations of selling it to the
U.S. Navy, CIA, and other government agencies. In the summer of 1979,
Relational Software, Inc. introduced the first commercially available
implementation of SQL, Oracle V2 (Version2) for VAX computers. Oracle V2
beat IBM's release of the System/38 RDBMS to market by a few weeks.
After testing SQL at customer test sites to determine the usefulness and
practicality of the system, IBM began developing commercial products based
on their System R prototype including System/38, SQL/DS, and DB2, which
were commercially available in 1979, 1981, and 1983, respectively.
between vendors, inappropriate handling of missing data, and unnecessarily
complex and occasionally ambiguous language grammar and semantics.
SQL
Paradigm Multi-paradigm
Appeared in 1974
Developer IBM
SQL:2006/ 2006
Influenced by
Influenced ,,
Standardization :
SQL was adopted as a standard by ANSI in 1986 and ISO in 1987. In the
original SQL standard, ANSI declared that the official pronunciation for SQL
is "es queue el". However, many English-speaking database professionals still
use the nonstandard pronunciation /sikwel/ (like the word "sequel"). Until
1996, the National Institute of Standards and Technology (NIST) data
management standards program was tasked with certifying SQL DBMS
compliance with the SQL standard. In 1996, however, the NIST data
management standards program was dissolved, and vendors are now relied
upon to self-certify their products for compliance.
The SQL standard has gone through a number of revisions, as shown below :
1992 SQL-92 SQL2, FIPS 127-2 Major revision (ISO 9075), Entry
Level SQL-92 adopted as FIPS
127-2.
The SQL standard is not freely available. SQL:2003 and SQL:2006 may be
purchased from ISO or ANSI. A late draft of SQL:2003 is freely available as a
Common
Source Full Name
Name
ANSI/ISO
SQL/PSM SQL/Persistent Stored Modules
Standard
Microsoft/
T-SQL Transact-SQL
Sybase
Procedural Language/PostgreSQL
PostgreSQL PL/pgSQL Structured Query Language (based on
Oracle PL/SQL)
(v) Unique Key : A unique key is the key by which a user can identify a
domain uniquely. It is different from the primary key in context that a
unique key can be null.
Queries :
The most common operation in SQL databases is the query, which is
performed with the declarative SELECT keyword. SELECT retrieves data
from a specified table, or multiple related tables, in a database. While often
grouped with Data Manipulation Language (DML) statements, the standard
Pitfalls of SQL 1
How SQL Saved my Dog 1
(The underscore character "_" is often used as part of table and column names
to separate descriptive words because other punctuation tends to conflict
with SQL syntax. For example, a dash "-" would be interpreted as a minus
sign.)
Under the precondition that isbn is the only common column name of the two
tables and that a column named title only exists in the books table, the above
query could be rewritten in the following form:
SELECT title, count(*) AS Authors
FROM books
NATURAL JOIN book_authors
GROUP BY title;
However, many vendors either don't support this approach, or it requires
certain column naming conventions. Thus, it is less common in practice.
Data retrieval is very often combined with data projection when the user is
looking for calculated values and not just the verbatim data stored in
primitive data types, or when the data needs to be expressed in a form that is
different from how it's stored. SQL allows the use of expressions in the select
list to project data, as in the following example which returns a list of books
that cost more than 100.00 with an additional sales_tax column containing a
sales tax figure calculated at 6% of the price.
SELECT isbn, title, price, price * 0.06 AS sales_tax
FROM books
WHERE price > 100.00
ORDER BY title;
Data manipulation :
First, there are the standard Data Manipulation Language (DML) elements.
DML is the subset of the language used to add, update and delete data:
INSERT is used to add rows (formally tuples) to an existing table, for example
:
INSERT INTO my_table (field1, field2, field3) VALUES ('test', 'N', NULL);
UPDATE is used to modify the values of a set of existing table rows, eg:
UPDATE my_table SET field1 = 'updated value' WHERE field2 = 'N';
DELETE removes zero or more existing rows from a table, eg:
DELETE FROM my_table WHERE field2 = 'N';
The SQL standard precisely specifies the syntax that a conforming database
system must implement. However, the standard's specification of the
semantics of language constructs is less well-defined, leading to areas of
ambiguity.
Many database vendors have large existing customer bases; where the SQL
standard conflicts with the prior behavior of the vendor's database, the
vendor may be unwilling to break backward compatibility.
(iii) To find all customers having an account at both the SFU and the
MetroTown branch :
(v) Find all customers having an account at the same branch as John :
(iii) Find the name of all customers having an account at the SFU branch,
but no loan from that branch.
Queries involving negation can be expressed by putting a sign under
the relation name beside an example row :
(iv) To find all customers who have accounts at two different branches : -
conditions
_x =John
(iii) To find all account numbers with balances between $1,300 and $1,500 :
conditions
_x 1300
_x 1500
(iv) Logical expressions and and or may appear in the condition box.
(v) To find all account numbers where the balance is between $1,300 and
$2,000, but is not $1,500 :
conditions
_x =( 1300 and 2000 and 1500
conditions
_x = (Burnaby or Richmond)
(ii) To sort first by name, and then by balance for those with multiple
accounts :
Aggregate Operations :
(i) QBE includes the aggregate operators AVG, MAX, MIN, SUM and
CNT. As QBE eliminates duplicates by default, they must have ALL.
appended to them.
(ii) To find the total balance of all accounts belonging to John :
(iii) All aggregate operators must have ALL. appended, so to override the
ALL.\ we must add UNQ. (unique). (NOTE: a number of examples in
the text incorrectly show UNQ. replacing ALL.)
(v) To find the average balances at only branches where the average is
more than $1,200, we add the condition box :
conditions
AVG.ALL._x > 1200
(vi) To find all customers who have an account at all branches located in
Burnaby, we can do :
conditions
CNT.UNQ.ALL._Y=
CNT.UNQ.ALL._Z
(v) Delete all loans with loan numbers between 1300 and 1500 :
conditions
_x =( 1300 and 1500)
Insertion :
(i) Insertion uses the I. operator.
(ii) To insert an account tuple for Smith :
Updates :
(i) We can update individual attributes with the U. operator. Fields left
blank are not changed.
(ii) To update the assets of the SFU branch to $10,000,000 :
□□□
Chapter-9
is pure C/C++ code with all the pure C/C++ portions intact. Then, a regular
C/C++ compiler is used to compile the code and produces the executable.
Pro*C Syntax
SQL
All SQL statements need to start with EXEC SQL and end with a semicolon
";". You can place the SQL statements anywhere within a C/C++ block, with
the restriction that the declarative statements do not come after the executable
statements. As an example :
{
int a;
/* ... */
EXEC SQL SELECT salary INTO :a
FROM Employee
WHERE SSN=876543210;
/* ... */
printf("The salary is %d\n", a);
/* ... */
}
Q.2 What is Dynamic SQL? Explain it with suitable example.
Ans.: Dynamic SQL is an enhanced form of Structured Query Language (SQL) that,
unlike standard (or static) SQL, facilitates the automatic generation and
execution of program statements. This can be helpful when it is necessary to
write code that can adjust to varying databases, conditions, or servers. It also
makes it easier to automate tasks that are repeated many times.
Dynamic SQL statements are stored as strings of characters that are entered
when the program runs. They can be entered by the programmer or
generated by the program itself, but unlike static SQL statements, they are not
embedded in the source program. Also in contrast to static SQL statements,
dynamic SQL statements can change from one execution to the next.
Dynamic SQL statements can be written by people with comparatively little
programming experience, because the program does most of the actual
OPEN
PREPARE
Example :
If we need to find all records from the customers table where City =
'London'. This can be done easily such as the following example shows in
SQL.
DECLARE @city varchar(75) SET @city = 'London'
SELECT * FROM customers WHERE City = @city
Ans.: In database packages, the term cursor refers to a control structure for the
successive traversal (and potential processing) of records in a result set.
A cursor is used for processing individual rows returned by the database
system for a query. It is necessary because many programming languages
suffer from impedance mismatch. Programming languages are often
procedural and do not offer any mechanism for manipulating whole result
sets at once. Therefore, the rows in a result set must be processed sequentially
by the application. In this way, a cursor can be thought of as an iterator over
the collection of rows in the result set.
OPEN cursor_name
A cursor is positioned on a specific row in the result set with the FETCH
statement. A fetch operation transfers the data of the row into the application.
Once all rows are processed or the fetch operation is to be positioned on a
non-existing row (cf. scrollable cursors below), a SQLSTATE '02000' (usually
accompanied by an SQLCODE +100) is returned by the DBMS to indicate the
end of the result set.
FETCH cursor_name INTO ...
The last step is to close the cursor using the CLOSE statement.
CLOSE cursor_name
Once a cursor is closed it can be opened again, which implies that the query is
evaluated again and a new result set is built.
□□□
Chapter-10
Q.1 What do you mean by Query Optimization? What are the Query
Evaluation Plans in RDBMS? How will you define Relational Query
Ans.: Query optimization is a function of many relational database management
systems in which multiple query plans for satisfying a query are examined
and a good query plan is identified. This may or not be the absolute best
strategy because there are many ways of doing plans. There is a trade off
between the amount of time spent figuring out the best plan and the amount
running the plan. Different qualities of database management systems have
different ways of balancing these two. Cost based query optimizers evaluate
the resource footprint of various query plans and use this as the basis for plan
selection. Typically the resources which are costed as CPU path length,
amount of disk buffer space, disk storage service time, and interconnect usage
between units of parallelism. The set of query plans examined is formed by
examining possible access paths (e.g., primary index access, secondary index
access, full file scan) and various relational table join techniques (e.g, merge
join, hash join, product join). The search space can become quite large
depending on the complexity of the SQL query. There are two types of
optimization. These consist of logical optimization which generates a
sequence of relational algebra to solve the query. In addition there is physical
optimization which is used to determine the means of carrying out each
operation.
Translating SQL Queries into Relational Algebra : Different optimizer
sequences such as the different Greek alphabet characters which are assigned
to them. This is explained in the article relational algebra.
The Goal of Query Optimization : The goal is to eliminate as many
unneeded tuples, or rows as possible. The following is a look at relational
algebra as it eliminates unneeded tuples. The project operator is
straightforward to implement if <attribute list> contains a key to relation R. If
close(): Closes the iterator, and releases any temporary resources (such as
temporary ¯les) held within its lifetime.
restart(): Restarts the iterator, i.e. as if it were just constructed.
explain(): A recursive function that gives a one- line explanation of the
iterator, and recurses on its inputs
(its children-iterators).
hasNext(): Returns true if the iterator has not visited all the tuples that are to
be returned by the operator implementing the interface.
□□□
Chapter-11
Q.1 How will you explain Backup & Recovery for the Database Management
System?
Ans.: Backup/Recovery involves the process of making a copy of a database in case
of an equipment failure or disaster, then recovering or retrieving the copied
database if needed.
One of the innumerable tasks of the DBA is to ensure that all of the databases
of the enterprise are always "available." Availability in this context means that
the users must be able to access the data stored in the databases, and that the
contents of the databases must be up-to-date, consistent, and correct. It must
never appear to a user that the system has lost the data or that the data has
become inconsistent. This would totally ruin the user's confidence in the
database and the entire system.
Many factors threaten the availability of the databases. These include natural
disasters (such as floods and earthquakes), hardware failures (for example, a
power failure or disk crash), software failures (such as DBMS malfunctions --
read "bugs" -- and application program errors), and people failures (for
example, operator errors, user misunderstandings, and keyboard trouble). To
this list we can also add the threats such as malicious attempts to destroy or
corrupt the contents of the database.
In a large enterprise, the DBA must ensure the availability of several
databases, such as the development databases, the databases used for unit
and acceptance testing, the operational online production databases (some of
which may be replicated or distributed all over the world), the data
warehouse databases, the data marts, and all of the other departmental
databases. All of these databases usually have different requirements for
availability. The online production databases typically must be available, up-
to-date, and consistent for 24 hours a day, seven days a week, with minimal
Q.3 Describe the different techniques which can be used for Recovery from an
Erroneous State.
Ans.: The following techniques can be used for recovery from an erroneous state :
Dump and Restart : The entire database must be backed up regularly to
archival storage. In the event of a failure, a copy of the database in a previous
correct state (such as from a checkpoint) is loaded back into the database. The
system is then restarted so that new transactions can proceed. Old
transactions can be re-executed if they are available. The following types of
restart can be identified :
A warm restart is the process of starting the system after a controlled
system shutdown, in which all active transactions were terminated
normally and successfully.
An emergency restart is invoked by a restart command issued by the
operator. It may include reloading the database contents from archive
storage.
A cold start is when the system is started from scratch, usually when a
warm restart is not possible. This may also include reloading the
database contents from archive storage. Usually used to recover from
physical damage, a cold restart is also used when recovery data was
lost.
Undo-Redo Processing (also called Roll-Back and Re-Execute) : By using an
audit trail of transactions, all of the effects of recent, partially completed
transactions can be undone up to a known correct state. Undoing is achieved
by reversing the updating process. By working backwards through the log, all
of the records of the transaction in question can be traced, until the begin
transaction operations of all of the relevant transactions have been reached.
The undo operation must be "idempotent," meaning that failures during undo
operations must still result in the correct single intended undo operation
taking place. From the known correct state, all of the journaled transactions
can then be re-executed to obtain the desired correct resultant database
contents. The operations of the transactions that were already executed at a
previous stage are obtained from the audit trail. The redo operation must also
be idempotent, meaning that failures during redo operations must still result
in the correct single intended redo operation taking place. This technique can
be used when partially completed processes are aborted.
Oracle :
Oracle7 Release 7.3 uses full and partial database backups and a redo log for
its database backup and recovery operations. The database backup is an
operating system backup of the physical files that constitute the Oracle
database. The redo log consists of two or more pre-allocated files, which are
used to record all changes made to the database. We can also use the export
and import utilities to create a backup of a database. Oracle offers a standby
database scheme, with which it maintains a copy of a primary database on
duplicate hardware, in a constant recoverable state, by applying the redo logs
archived off the primary database.
A full backup is an operating system backup of all of the data files, parameter
files, and the control file that constitute the database. A full database backup
can be taken by using the operating system's commands or by using the host
command of the Server Manager. A full database backup can be taken online
when the database is open, but only an offline database backup (taken when
the database server is shut down) will necessarily be consistent. An
inconsistent database backup must be recovered with the online and archived
redo log files before the database will become available. The best approach is
to take a full database backup after the database has been shut down with
normal or immediate priority.
A partial backup is any operating system backup of a part of the full backup,
such as selected data files, the control file only, or the data files in a specified
tablespace only. A partial backup is useful if the database is operated in
ARCHIVELOG mode. A database operating in NOARCHIVE mode rarely
has sufficient information to use a partial backup to restore the database to a
consistent state. The archiving mode is usually set during database creation,
but it can be reset at a later stage.
We can recover a database damaged by a media failure in one of three ways
after you have restored backups of the damaged data files. These steps can be
performed using the Server Manager's Apply Recovery Archives dialog box,
using the Server Manager's RECOVER command, or using the SQL ALTER
DATABASE command :
We can recover an entire database using the RECOVER DATABASE
command. This command performs media recovery on all of the data
files that require redo processing.
We can recover specified tablespaces using the RECOVER
TABLESPACE command. This command performs media recovery on
all of the data files in the listed tablespaces. Oracle requires the
database to be open and mounted in order to determine the file names
of the tables contained in the tablespace.
We can list the individual files to be recovered using the RECOVER
DATAFILE command. The database can be open or closed, provided
that Oracle can take the required media recovery locks.
In certain situations, we can also recover a specific damaged data file, even if
a backup file isn't available. This can only be done if all of the required log
files are available and the control file contains the name of the damaged file.
In addition, Oracle provides a variety of recovery options for different crash
scenarios, including incomplete recovery, change-based, cancel-based, and
time-based recovery, and recovery from user errors.
□□□
Chapter-12
Database Design
answers to the question of what this particular employee's address is. This
phenomenon is known as an update anomaly.
There are circumstances in which certain facts cannot be recorded at all. For
example, each record in a "Faculty and Their Courses" table might contain a
Faculty ID, Faculty Name, Faculty Hire Date, and Course Code—thus we can
record the details of any faculty member who teaches at least one course, but
we cannot record the details of a newly-hired faculty member who has not
yet been assigned to teach any courses. This phenomenon is known as an
insertion anomaly.
History :
Edgar F. Codd first proposed the process of normalization and what came to
be known as the 1st Normal Form.
There is, in fact, a very simple elimination procedure which we shall call
normalization. Through decomposition non-simple domains are replaced by
"domains whose elements are atomic (non-decomposable) values."
—Edgar F. Codd, A Relational Model of Data for Large Shared Data Banks.
In his paper, Edgar F. Codd used the term "non-simple" domains to describe a
heterogeneous data structure, but later researchers would refer to such a
structure as an abstract data type.
Normal Forms :
The Normal Forms (abbrev. NF) of relational database theory provide criteria
for determining a table's degree of vulnerability to logical inconsistencies and
anomalies. The higher the normal form applicable to a table, the less
vulnerable it is to inconsistencies and anomalies. Each table has a "highest
normal form" (HNF): by definition, a table always meets the requirements of
its HNF and of all normal forms lower than its HNF; also by definition, a
table fails to meet the requirements of any normal form higher than its HNF.
The normal forms are applicable to individual tables; to say that an entire
database is in normal form n is to say that all of its tables are in normal form
n.
Newcomers to database design sometimes suppose that normalization
proceeds in an iterative fashion, i.e. a 1NF design is first normalized to 2NF,
then to 3NF, and so on. This is not an accurate description of how
normalization typically works. A sensibly designed table is likely to be in 3NF
on the first attempt; furthermore, if it is 3NF, it is overwhelmingly likely to
have an HNF of 5NF. Achieving the "higher" normal forms (above 3NF) does
not usually require an extra expenditure of effort on the part of the designer,
because 3NF tables usually need no modification to meet the requirements of
these higher normal forms.
Edgar F. Codd originally defined the first three normal forms (1NF, 2NF, and
3NF). These normal forms have been summarized as requiring that all non-
key attributes be dependent on "the key, the whole key and nothing but the
key". The fourth and fifth normal forms (4NF and 5NF) deal specifically with
EMP Table
Á Â Ã
EMP ENAME JOB MGR HIREDATE SAL COMM DEPTNO
NO
7839 KING PRESIDENT Å 17-NOV-81 5000 10
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUNE-81 2450 10
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7844 TURNER SALESMAN 7698 08-SEP-81 1500 Ä0 30
7900 JAMES CLERK 7698 03-DEC-81 950 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7369 SMITH CLERK 7902 17-DEC-80 800 20
7788 SCOTT ANALYST 7566 09-DEC-82 3000 20
7876 ADAMS CLERK 7788 12-JAN-83 1100 20
7934À MILLER CLERK 7782 23-JAN-82 1300 10
“Domain/Key Normal Form (or DKNF) requires that a table not be subject to
any constraints other than domain constraints and key constraints.‖
Sixth Normal Form :
A table is in Sixth Normal Form (6NF) if and only if it satisfies no non-
trivial join dependencies at all, meaning that the fifth normal form is also
satisfied. The sixth normal form was only defined when extending the
relational model to take into account the temporal dimension. Most SQL
technologies, as of 2005, do not take into account this work, and most
temporal extensions to SQL are not relational. See work by Date, Darwen and
Lorentzos worked for a relational temporal extension, Zimyani for further
discussion on Temporal Aggregation in SQL, or TSQL2 for a non-relational
approach.
The idea behind domain-key normal form is to specify the 'Ultimate normal
form' that takes into account all possible types of dependencies and
constraints. Before defining DKNF formally let us define few types of
constraints.
Domain Constraint: It specifies that each attribute, Ai of relation R (A1, A2 ....
An), must have a value from a set SAi. Domain Constraint on attribute Ai is
specified as IN (Ai, SAi) we have used domain constraints as a part of
integrity constraints.
Key Constraint: For the relation schema R (A1, A2 An), the Key Constraint,
KEY (K], where K is a subset of R, is the restriction that no two tuples of
relation r defined on 'the relation schema R have the same value for the
attributes in K.
General Constraint: A general constraint is expressed as a simple statement
or predicate and specifies some special requirement that each tuple of a
relation must satisfy to be a valid tuple. For an example or general constraint
consider the relation catalog (pid, sid, cost) shown in figure 6.23 where pid is
the id of product~ sid is the id of supplier and cost is the cost of product
supplied by a supplier suppose we have constraint that if cost of a product is
more than Rs. 5000 supplier will be only A or C otherwise it may be one of A,
B, C, D or E. This constraint can not be expressed as domain constraint or a
key constraint and hence has to be categorized as general constraint.
P Si Co
1 D 200
1 B 300
1 C 550
1 E 400
1 A 580
0 0
Figure 6.23 : Instance of Catalog relation
□□□
Chapter-13
Database Tuning
To understand why, think about the tuples that got inserted into
borrow and customer. So we can think about how the view is
recomputed for the above query.
Q.2 What do you mean by Tuning? Also define Tuning Indexes in brief.
Ans.: Database Tuning describes a group of activities used to optimize and
homogenize the performance of a database. It usually overlaps with query
tuning, but refers to configuration of the database files, the database
management system (DBMS), and the operating system and hardware the
DBMS runs on.
The goal is to maximize use of system resources to perform work as
efficiently and rapidly as possible. Most systems are designed to manage
work efficiently, but it is possible to greatly improve performance by
customizing settings and the configuration for the database and the DBMS
being tuned.
Index tuning as part of database tuning is the task of selecting and creating
indexes with the goal of reducing query processing times. However, in
dynamic environments with various ad-hoc queries it is difficult to identify
potentially useful indexes in advance. So that need for new indexing schemes
suitable for self-tuning. Based on problems with previous approaches we
describe the key concepts, which are sparse and partial indexing, usage-
balanced instead of data-balanced structures, and dynamic resource
assignment. We illustrate the approach by a simple index structure, which
provides adaptability as well as improved access characteristics for indexing
in this manner.
□□□
Chapter-14
□□□
Chapter-15
Q. 3. Describe all the main features of EDM in context of data wear housing and
Business intelligence.
Ans. Data Architecture
In a BI environment, it is extremely important to map, visualize and,
ultimately, model the structure and flow of data as it flows from the source
systems to the various reporting systems. The business requirements, along
with the intrinsic relationships that exist among various entities and
of appropriate technology. It is the ―glue‖ that holds the entire EDM strategy
together.
In the context of the enterprise, many organizations resort to establishing a
formal business intelligence competency center (BICC), creating roles such as
the chief data officer (CDO) to provide the seriousness and espouse the
culture that treats enterprise data as a ―strategic asset.‖ This organizational
body is also responsible for making project priority decisions, providing skill-
set training and cross-functional grooming, and providing opportunities
within the enterprise as a whole for selecting tools and technology, as well as
for evangelizing the ROI benefits of various BI initiatives across business and
IT.
Successful BI implementations have realized the importance of data
governance and have made the right investments in being able to precisely
define who the producers, administrators and, possibly, consumers are for its
enterprise data.
One grassroots movement worth mentioning in the EDM space is
EDMCouncil.org, which is a nonprofit trade association focused on managing
and leveraging enterprise data as a strategic asset to enable institutions to
increase efficiency, minimize risk and create competitive advantage.
As you can see, investing in a sound EDM strategy built on the six
components outlined at the beginning of this article can pay rich dividends
toward successful data warehousing and business intelligence investments.
As a matter of fact, I would even go beyond that and say that not only data
warehousing and business intelligence, but other data initiatives (as outlined
in the oval in Figure 1) can benefit from a good EDM strategy (as shown
along the edges of the hexagon in Figure 1). Some of the sub-components of
the EDM strategy are listed inside the hexagon.
end. Ideally you can use a standard way of communicating over the internet
to provide flexibility.
The way this common capability would work would be to pass a message or
series of messages between the central and remote systems. The remote
system would be able to accept a query about its local database, access the
database to retrieve that query and then pass the results back to the central
system.
So, we can say that the remote system acts as a translator between the
messages that go between it and the central system, and those that goes to
and from the database. The database does not need to know about the
internet, it is hidden from that by the rest of the system.
Q.5 Define Transactions and Concurrency in respect of ACID rules.
Ans. In addition to data model, most practical databases (―transactional database‖)
attempt to enforce a data transaction. Ideally, the database software should
enforce the ACID rules, summarized here :
able to ensure that only serializable, recoverable schedules are allowed, and
that no actions of committed transactions are lost while undoing aborted
transactions.
□□□
Year - 2011
16. Database is a :
(a) Collection of any information
(b) Collection of related data
(c) Collection of entities
(d) None of the above ( )
21. To express all the constraints on the domain variables, condition box features is use
in:
(a) QBE
(b) QUEL
(c) SQL
(d) None of the above ( )
22. All action of a transaction be executed completely or in the case of some failure,
partial effects of a transaction be undone. This property of transaction is called:
(a) Durability
(b) Atomicity
(c) Consistency
(d) Isolation ( )
28. The command used in SQL, to make any privilege from any user is:
(a) Grant
(b) Revoke
(c) Delete
(d) Modify ( )
29. The type of constraint that can be used to protect data is:
(a) Domain
(b) Referential Integrity
(c) Integrity
(d) None of the above ( )
30. A user interact with the system without writing program is called:
(a) Naïve user
(b) Application programme
(c) Sophisticated user
(d) Specialized users ()
31.is responsible for fetching data from disk into main memory.
(a) File manager
(b) Buffer manager
(c) Transaction manager
(d) Integrity manager ( )
(b) Directory
(c) Unidata
(d) Database ( )
DESCRIPTIVE PART - II
Year 2011
Time allowed : 2 Hours Maximum Marks : 30
Attempt any four questions out of the six. All questions carry 7½ marks each.
1. (a) How can you say that the database management system is better than the file
processing system? Explain.
(b) What do you understand by Data Abstraction and Data
Independence? Explain
2. (a) What is Domain integrity, Referential Integrity and entity integrity? Explain
each by giving suitable examples.
(b) What do you understand by Functional Dependencies? Explain by giving
suitable example.
(i) Create emp tabl with emp_no primary key and dept_no. as foreigh key.
(ii) List names of all the departments and number of employees working under it.
(iii) List all the employee who live in the cities starting from either „A‟ or „B‟
(iv) Update address and city for employee having emp_no = 1011.
(v) Delete records from emp table where wmp_name start with „A‟ or „B‟
4. How does normalization play a major role in designing of RDBMS? Discuss “Every
schema in their normal form (3NF) must be in BCNF” with suitable example.
5. Discuss the naming convention and notation used for represent E-R diagram. Explain
E-R model with suitable example.
Year - 2010
13. Which of the following clauses is usually together with aggregate function?
(a) Order by ASC (b) Order by DESC
(c) Group by (d) None of the above ()
14. Which of the following eliminates duplicate rows from a query results?
(a) No Duplicate (b) Unique
(c) Distnct (d) All of the above ()
(a) IN
(b) BETWEEN
(c) LIKE
(d) All of the above ()
20. A view is a :
(a) Master table (b) Child table
(c) Virtual table (d) Table ( )
(d) DMM ()
26. The level of data abstraction which describes what relationship exists among data is:
(a) Physical level (b) View level
(c) Conceptual level (d) Storage level ()
(a) Shared
(b) Exclusive
(c) Two phase locking
(d) All of the above ( )
38. The first action the system must in query processing is:
(a) Estimate the cost of query
(b) Translate a query into its internal form
(c) Verify the execution plan
(d) None of the above ( )
Answer Key
1. (a) 2. (d) 3. (b) 4. (d) 5. (b) 6. (b) 7. (b) 8. (c) 9. (a) 10. (c)
11. (a) 12. (b) 13. (c) 14. (b) 15. (c) 16. (d) 17. (a) 18. (d) 19. (a) 20. (c)
21. (c) 22. (c) 23. (c) 24. (c) 25. (c) 26. (c) 27. (d) 28. (d) 29. (a) 30. (d)
31. (d) 32. (a) 33. (d) 34. (d) 35. (a) 36. (d) 37. (c) 38. (b) 39. (d) 40. (d)
DESCRIPTIVE PART - II
Year 2010
Time allowed : 2 Hours Maximum Marks : 30
Attempt any four questions out of the six. All questions carry 7½ marks each.
Q.1 (a) What is DBMS? Why DBMS is better than file processing system?
(b) Explain the overall system structure with diagram.
Q.2 (a) What is the difference between centralized and distributed database models?
(b) Solve the following query in Relational Algebra using the following
scheme: Emp (Ecode, Ename, Address, City, Salary)
Debt (Dno, Dname, Ecode)
(i) Find all employees name, city who get salary > 10,000.
(ii) Display Ecode, Dno, Dname, for all employee where department name is
"Computer Science".
(iii) Find the employee who get maximum salary.
(iv) Find the employee's who live in city Jaipur and salary greater than 25,000.
Q.3 (a) What is Normalization? Explain different normal forms with suitable
example.
(b) Suppose that we decompose the schema R (A, B, C, D, E) into (A, B, C) and
(A, D, E). Show that this decomposition is a losses decomposition if the
following set F of functional dependencies holds.
Q.4 (a) Explain the DBTG Network Data Model. How we represent many to many
relationship in network model.
(b) What is object-oriented model? How does the concept of an object in object-
oriented model differ from the concept of an entity in entity relationship
model?
Year - 2009
The question paper contains 40 multiple choice questions with four choices and student
will have to pick the correct one (each carrying ½ mark).
3. If every non key attribute is functionally dependent on the primary key, then the
relation relation will be in:
(a) First N. Form
(b) Second N. Form
(c) Third N.Form
(d) Fourth N. Form ( )
6. Which of the following desired features are beyond the capability of Relational
Algebra:
(a) Aggregate Computation
(b) Multiplication
7. In airline, destination system the, system have flight no., place of departure,
destination, type of place and seats available The primary key is:
(a) Flight No.
(b) Flight No. and place of departure
(c) Flight No. and date
(d) Flight No. and destination ()
12. An attribute of one table matching the primary key of another table, is called:
(a) foreign key (b) secondary key
(c) candidate key (d) composite key ( )
13.13. The employee salary should not be more than Rs. 2,000 this is :
(a) Referential constraint (b) Integrity constraint
(c) Over defined constraint (d) Feasible constraint ( )
20. PL/SQL does not support arrays however equivalent construct which is:
(a) Records (b) Packages
(c) Types (d) Collection ()
24. The data model, which describes how the data is actually stored, is:
25. A view of the database that appears to an application program is known is:
(a) Schema (b) Subschema
(c) Virtual table (d) None of the above ( )
26. Which of the following design is both software and hardware independent:
(a) Logical
(b) Conceptual
(c) Physical
(d) None of the above ( )
30. The level of data abstraction which describes how the data is actually stored is:
(a) Physical level (b) Storage level
(c) conceptual level (d) View level ( )
33. Which of the following command is used to get all the columns in a table?
(a) # (b) %
(c) * (d) @ ( )
34. Which of the following aggregate functions does not ignore nulls in its results:
(a) Count (b) MAX
(c) Count (*) (d) MIN ( )
37. The principle means of identifying entities within an entity set, in a relational
database is:
(a) Tuple (b) Pointer
(c) Record (d) Primary key ( )
Answer Key
1. (b) 2. (d) 3. (b) 4. (b) 5. (b) 6. (c 7. (a) 8. (c) 9. (c) 10. (d)
11. (a) 12. a) 13. (b) 14. (d) 15. (a) 16. (b) 17. (c) 18. (c) 19. (d) 20. (d)
21. (b) 22. (b) 23. (a) 24. (a) 25. (b) 26. (d) 27. (b) 28. (c) 29. (d) 30. (a)
31. (a) 32. (d) 33. (c) 34. (d) 35. (b) 36. (c) 37. (b) 38. (b) 39. (c) 40. (b)
DESCRIPTIVE PART - II
Year 2009
Time allowed : 2 Hours Maximum Marks : 30
Attempt any four questions out of the six. All questions carry 7½ marks each.
Q.1 (a) What are different levels of data base architecture? Describe conceptual level
in detail.
(b) What is IMS hierarchy? Write a note on Data and Information.
Q.3 (a) What are different normalization forms? Mention the application of IT.
(b) Define scheme and subschema. Discuss the concepts of Relational Algebra.
Q.4 (a) What is database query languages? Mention few query language commands?
(b) What are nested queries? Write a note on aggregate functions.
Year - 2008
6. A DML that specify what data are needed without specifying how to get those data,
called:
(a) Procedural (b) Query
(c) DDL (d) Non procedural DML ( )
37. Every non key attribute is fully dependent upon the primary key is called:
(a) 1 NF (b) 2 NG
(c) 3 NF (d) 4 NF ()
Answer Key
1. (b) 2. (d) 3. (b) 4. (b) 5. (c) 6. (b) 7. (c) 8. (b) 9. (b) 10. (a)
11. (c) 12. (c) 13. (a) 14. (b) 15. (c) 16. (a) 17. (b) 18. (d) 19. (d) 20. (a)
21. (c) 22. (b) 23. (b) 24. (c) 25. (a) 26. (a) 27. (d) 28. (c) 29. (d) 30. (c)
31. (a) 32. (b) 33. (d) 34. (a) 35. (d) 36. (a) 37. (b) 38. (d) 39. (a) 40. (a)
DESCRIPTIVE PART - II
Year 2008
Time allowed : 2 Hours Maximum Marks : 30
Attempt any four questions out of the six. All questions carry 7½ marks each.
Q.1 (a) What do you mean by Data Abstraction and Data Independence?
(b) What are data base model? Discuss the basic concepts and structure of a
relational database model.
Q.2 Explain do you term normalization and various normal from 1NF, 2 NF, 3 NF and
BCNF with the help of example.
Q.3 (a) What do you understand by performance tuning of a database system? Explain
(b) What is database security? Discuss different ways to achieve
database security.
Year - 2007
The question paper contains 40 multiple choice questions with four choices and student
will have to pick the correct one (each carrying ½ mark).
2. The collection of conceptual tools for describing data, data relationship data
semantics and consistency constraints is called :
(a) Database
(b) Metabase
(c) Data model
(d) All of the above ( )
4. The model, that uses the collection of tables to represent both data and the
relationship among those data is called:
(a) Relational model
(b) Hierarchical model
(c) Network model
(d) None of the above ( )
7. Let R1, and R2 are two relations, then R1–R2 contains the tuples:
(a) That are in R1 but not in R2
(b) That are in R2 but not in R1
(c) Any of the above
(d) None of the above ( )
8. The operational used in relational algebra, suitabled to queries that include the phase
"for all" is:
(a)
(b) n
(c) –
(d) U ()
11. In SQL, the clause used to specify the list of relation is:
(a) Select
(b) Where
(c) From
(d) Having ()
12. To select the tuples explicitly so that duplicates are not removed in SQL the keyword
used is:
(a) With
(b) All
(c) Distinct
(d) NOT ()
14. In SQL, if we want to change a value in a tuple without changing all values in the
tuple with a condition and this condition is specified with the clause:
(a) Where
(b) With
(c) Having
(d) None of the above ( )
15. To express all the constraints on the domain variables, condition box feature is used
in:
(a) QBEL (b) QUEL
(c) SQL (d) None of the above ()
16. "All actions of a transaction be executed completely or in the case of some failure,
partial effects of a transaction be undone". This property of transaction is called:
(a) Durability (b) Atomicity
(c) Consistency (d) Isolation ( )
18. Which of the following will not cause any type of transaction failure?
(a) Some interval condition such as bad input
(b) System crash
(c) Inconsistency of data
(d) None of the above ( )
20. Which of the following is the problem in the early file system?
(a) Inconsistency of data
(b) Redundancy of data
(c) Both of the above
(d) None of the above ( )
31. Which of the following is not the property of canonical cover FC?
(a) No functional dependency in FC contains an extraneous attribute
(b) Each left side of a functional dependency in FC contains single attribute
(c) Each left side of a functional dependency in FC contains single attribute
(d) None of the above ( )
32. To protect the database, we must take security measure at several levels, which of the
following levels is not one of them:
(a) Database system
(b) Operating system
(c) Physical
(d) None of the above ( )
34. The command used in SQL, to make any privilege from any user is:
(a) Grant
(b) Revoke
(c) Delete
(d) Modify ( )
36. The type of constraint that can be used to protect data is:
(a) Domain
(b) Referential integrity
(c) Integrity
(d) Primary key ( )
37. If records of a relation are sorted by a field (Primary key) on which, you have created
an indexed. The type of index in this case will be:
(a) Primary index
(b) Secondary index
(c) Clustering index
(d) Any of the above ( )
40. In QBE, to retrieve any field of a relation the command is indicated by:
(a) R (b) S
(c) P (d) I ()
Answer Key
1. (a) 2. (c) 3. (c) 4. (a) 5. (d) 6. (d) 7. (a) 8. (a) 9. (d) 10. (c)
11. (c) 12. (c) 13. (b) 14. (a) 15. (a) 16. (b) 17. (c) 18. (d) 19. (d) 20. (c)
21. (b) 22. (b) 23. (b) 24. (d) 25. (c) 26. (b) 27. (c) 28. (a) 29. (d) 30. (c)
31. (a) 32. (c) 33. (c) 34. (a) 35. (b) 36. (c) 37. (c) 38. (c) 39. (b) 40. (c)
DESCRIPTIVE PART - II
Year 2007
Time allowed : 2 Hours Maximum Marks : 30
Attempt any four questions out of the six. All questions carry 7½ marks each.
Q.2 Discuss different guidelines which must be satisfied by a good database design.
Discuss 1 NF with an example.
Q.3 How will you compare the early file system approach with database system
approach. Discuss in detail with suitable example.
(b) Exists
(c) NULL
Year - 2006
2. DBA is:
(a) Database administration
(b) Database abstraction
(c) Database administration
(d) None of the above ( )
3. Database is:
(a) Collection of any information
(b) Collection of related data
(c) Collection of entities
(d) None of the above ( )
6. The capacity to change the conceptual schema without having to change external
schema is:
(a) Physical data independence
(b) Logical data independence
16. QBE is :
(a) Query by example
(b) Query by exercise
(c) Query by extension
(d) None of the above ( )
(d) SUM ()
25. Key in SQL, that requires parent and child tables is:
(a) Primary key
(b) Foreign key
(c) Composite
(d) Candidate key ( )
28. You can not update a view in SQL, if the view is created using:
(a) Primary key
(b) Foreign key
(c) Group key
(d) None of the above ( )
(c) Distinct
(d) None of the above ( )
31. Designing a database, we avoid taking NULL values in the relation because:
(a) NULL requires more space
(b) NULL can create inconsistency
(c) NULL is not defined
(d) None of the above ( )
32. The type of data storage that does no service system crashes:
(a) Volatile storage
(b) Non volatile storage
(c) Stable storage
(d) None of the above ( )
34. A value that appears in one relation for a given set of attribute also appears for certain
set of attributes in another relation. This condition is called:
(a) Domain constraint
(b) Referential integrity
(c) Integrity
(d) None of the above ( )
(a) DDL
(b) DML
(c) Both a and b
(d) None of the above ( )
Answer Key
1. (d) 2. (a) 3. (b) 4. (c) 5. (a) 6. (b) 7. (b) 8. (c) 9. ( a) 10. (a)
11. (c) 12. (a) 13. (a) 14. (b) 15. (b) 16. (a) 17. (a) 18. (d) 19. (d) 20.(b)
21. (a) 22. (a) 23. (a) 24. (c) 25. (b) 26. (a) 27. (a) 28. (b) 29. (a) 30. (b)
31. (d) 32. (a) 33. (b) 34. (b) 35. (c) 36. (d) 37. (c) 38. (c) 39. (d) 40. (c)
DESCRIPTIVE PART - II
Year 2006
Time allowed : 2 Hours Maximum Marks : 30
Attempt any four questions out of the six. All questions carry 7½ marks each.
Q.4 What do you mean by functional dependency? Write and prove and following rules
of functional dependency:
(a) Transitivity Dependency (b) Union Rule
Q.5 What do you mean by normalization? Discuss BCNF and 3 NF with examples.
Key Term
Application
From a data management system perspective: A computer program that utilizes database data in its
processing.
Attribute
A characteristic of an entity/object, F.ex. the name of a person.
Browse
In data management: to scan and/or read quickly through lists and/or documents resulting from a
database query.
Dictionary: to read or look over something in a casual way. (Webster, 1996)
Controlled vocabulary
A term found in library science and practice for a hierarchical taxonomy of terms describing a certain
area of knowledge. Also the term used for specification of Dublin Core element values.
Digital Library, DL
A large collection of digital documents representing possibly complex multimedia documents, stored
in multiple databases, with a data management system providing functions for: document capture,
cataloging, indexing, search, retrieval, and presentation.
Note: There is still (2001) debate on the definition of a digital library.
Document
In data management, an electronic document may contain any combination of formated, semi-, and
unformated data such as: formatted fields - title, date, author(s), - running text, charts, images, maps,
film, audio, and/or video. A document can be stored as a binary or character large object (BLOB or
CLOB) and may be in hypertext or hypermedia format.
Domain
The set of valid values for an attribute.
Domain ontology
A hierarchical taxonomy of terms describing a specific area of knowledge, such as medical,
engineering, computer science, ... .
Synonym concept: controlled vocabulary.
End user
The intended user of an information system, commonly not an IT person.
Identifier
synonyms: primary key, object identifier
A set of attribute value(s) that uniquely identifies one occurrence of an entity-type.
F.ex. a social security number uniquely identifies one person.
In the Object-oriented paradigm: the object identifier, OID, is system generated, i.e. has no external
(to the computer) meaning.
Index
In data management, a file structure used to facilitate access to stored data.
Information Retrieval, IR
From Library and Information Science, the process of selecting text documents (articles, journals,
and/or books) deemed relevant to an information request statement. The process can be performed by
the information seeker, a librarian, with or without the help of an electronic Information Retrieval
System.
Information System
A system consisting of human users, application programs, a database, and a DMS. An information
system always serves some purpose.
Interface
In data management, that part of a DMS through which a user communicates with the system. The
interface consists of a set of forms and/or a set of query languages.
Internet
The transport system (telephone lines, cables, satellites, and computer nodes) that support electronic
communication.
Legacy systems
Operative systems using old data management technology.
Media object
An artifact representing facts, ideas, and or events. Examples of media objects include; tables, text
documents, images, maps, 3D objects, film, music and speech. These can be represented in computers
as media data.
Metadata
Data describing the structure and content of a data collection.
Typically metadata for structured/relational database systems includes: entity/object names, their
attribute names, the data and domain types used and value ranges as applicable. In addition,
structural metadata includes the inter-relationships between data elements and their cardinality,
storage locations, and data usage.
Metadata associated with media objects would typically include context metadata such as the
author/creater, a title, the date of creation, source, type, as well as a semantic or content
metadata descriptions including a feature and/or keyword list and summary or abstract.
Multimedia Data
Data representing integrated multiple media objects. Multimedia objects include; tables of numeric
and alphanumeric data with embedded media data, text documents with embedded images, maps, film
or video with synchronized image and audio streams. These data require special processes for
presentation, often on multiple visual and audio media.
Multimedia Database
A database containing a collection of logically related multimedia data.
Normalization
In DB design, a set of rules guiding the definition of structurally well-formed relations for relational
database implementation.
Query
An information request, formulated in the query language of a DMS.
Query Language, QL
Part of DMS interface that is used for expressing information requests to the system.
Query Processing
The part of a DMS that interprets and executes a query against a database. Query processing also
includes compilation and presentation of the query results, i.e. the retrieved data.
Relationship
In data management, an associative or hierarchic link between two or more entity types.
Schema
Synonym: data catalog
The name of the collection of metadata describing the structure and constraints of a database.
The terms schema and data catalog are used synonymously in different literature on database
management systems to specify the location of the data describing the content and structure of a
database. Most common components include: entity and attribute names, the set of attribute
types
describing each entity type, the data type and domain for each attribute, inter-entity type relationships,
cardinality constraints, data locations, associated indexes, and usage restrictions.
The contents of the schema are defined using the data definition language, DDL, of the data
management system.
Semantic gap
In image retrieval: The difference between the semantic intent of a user query and the DB image
representation.
Semantic heterogeneity
In multi-database management: The differences between the models, metadata, and structures used
for the design and implementation of different databases that represent the 'same' real-world
information.
Tabular data
well-structured, atomic data values used to record data in a RDB.
Thesaurus
In information/data retrieval, a tool/index for resolving synonyms.
User The intended primary user of a computer based system, often qualified as the "end user" to
indicate a non-IT person or group.
Web
short name for World Wide Web
The connection of sites providing information/data in HTML, XML (or other specific Web language)
pages.
Web DB
Most commonly, a database accessible from the Web, i.e. a database system with a Web interface.
2. DBA is:
(a) Database administration
(b) Database abstraction
(c) Database administration
(d) None of the above ( )
3. Database is:
(a) Collection of any information
(b) Collection of related data
(c) Collection of entities
(d) None of the above ( )
6. The capacity to change the conceptual schema without having to change external
schema is:
(a) Physical data independence
(b) Logical data independence
(c) Data abstraction
(d) None of the above ( )
(c)
(d) None of the above ( )
16. QBE is :
(a) Query by example
(b) Query by exercise
(c) Query by extension
(d) None of the above ( )
25. Key in SQL, that requires parent and child tables is:
(a) Primary key
(b) Foreign key
(c) Composite
(d) Candidate key ( )
28. You can not update a view in SQL, if the view is created using:
(a) Primary key
(b) Foreign key
(c) Group key
(d) None of the above ( )
31. Designing a database, we avoid taking NULL values in the relation because:
(a) NULL requires more space
(b) NULL can create inconsistency
(c) NULL is not defined
(d) None of the above ( )
32. The type of data storage that does no service system crashes:
(a) Volatile storage
(b) Non volatile storage
(c) Stable storage
(d) None of the above ( )
34. A value that appears in one relation for a given set of attribute also appears for certain
set of attributes in another relation. This condition is called:
(a) Domain constraint
(b) Referential integrity
(c) Integrity
(d) None of the above ( )
(a) DDL
(b) DML
(c) Both a and b
(d) None of the above ( )
42. The collection of conceptual tools for describing data, data relationship data
semantics and consistency constraints is called :
(a) Database
(b) Metabase
(c) Data model
(d) All of the above ( )
43. In E-R data model, attributes of entity sets are represented by:
(a) rectangles
(b) diamonds
(c) Ellipses
(d) Lines ( )
44. The model, that uses the collection of tables to represent both data and the
relationship among those data is called:
(a) Relational model
(b) Hierarchical model
(c) Network model
(d) None of the above ( )
(d) ( )
47. Let R1, and R2 are two relations, then R1–R2 contains the tuples:
(a) That are in R1 but not in R2
(b) That are in R2 but not in R1
(c) Any of the above
(d) None of the above ( )
48. The operational used in relational algebra, suitabled to queries that include the phase
"for all" is:
(a)
(b) n
(c) –
(d) U ()
51. In SQL, the clause used to specify the list of relation is:
(a) Select
(b) Where
(c) From
(d) Having ()
52. To select the tuples explicitly so that duplicates are not removed in SQL the keyword
used is:
(a) With
(b) All
(c) Distinct
(d) NOT ()
54. In SQL, if we want to change a value in a tuple without changing all values in the
tuple with a condition and this condition is specified with the clause:
(a) Where
(b) With
(c) Having
(d) None of the above ( )
55. To express all the constraints on the domain variables, condition box feature is used
in:
(a) QBEL (b) QUEL
(c) SQL (d) None of the above ()
56. "All actions of a transaction be executed completely or in the case of some failure,
partial effects of a transaction be undone". This property of transaction is called:
(a) Durability (b) Atomicity
(c) Consistency (d) Isolation ( )
58. Which of the following will not cause any type of transaction failure?
(a) Some interval condition such as bad input
(b) System crash
(c) Inconsistency of data
(d) None of the above ( )
60. Which of the following is the problem in the early file system?
(a) Inconsistency of data
(b) Redundancy of data
(c) Both of the above
(d) None of the above ( )
71. Which of the following is not the property of canonical cover FC?
(a) No functional dependency in FC contains an extraneous attribute
(b) Each left side of a functional dependency in FC contains single attribute
(c) Each left side of a functional dependency in FC contains single attribute
(d) None of the above ( )
72. To protect the database, we must take security measure at several levels, which of the
following levels is not one of them:
(a) Database system
(b) Operating system
(c) Physical
(d) None of the above ( )
74. The command used in SQL, to make any privilege from any user is:
(a) Grant
(b) Revoke
(c) Delete
(d) Modify ( )
76. The type of constraint that can be used to protect data is:
(a) Domain
(b) Referential integrity
(c) Integrity
(d) Primary key ( )
77. If records of a relation are sorted by a field (Primary key) on which, you have created
an indexed. The type of index in this case will be:
(a) Primary index
(b) Secondary index
(c) Clustering index
(d) Any of the above ( )
80. In QBE, to retrieve any field of a relation the command is indicated by:
(a) R (b) S
(c) P (d) I ()
(b) schema
(c) subschema
(d) data independence ( )
86. A DML that specify what data are needed without specifying how to get those data,
called:
(a) Procedural (b) Query
(c) DDL (d) Non procedural DML ( )
87. A user interact with the system without writing program is called:
(a) naive user
(b) application programmer
(c) Sophisticated user
(d) specialized users ()
(a)
(b)
(c)
(d) X ( )
117. Every non key attribute is fully dependent upon the primary key is called:
(a) 1 NF (b) 2 NG
(c) 3 NF (d) 4 NF ()
Answer Key
1. (d) 2. (a) 3. (b) 4. (c) 5. (a) 6. (b) 7. (b) 8. (c) 9. ( a) 10. (a)
11. (c) 12. (a) 13. (a) 14. (b) 15. (b) 16. (a) 17. (a) 18. (d) 19. (d) 20.(b)
21. (a) 22. (a) 23. (a) 24. (c) 25. (b) 26. (a) 27. (a) 28. (b) 29. (a) 30. (b)
31. (d) 32. (a) 33. (b) 34. (b) 35. (c) 36. (d) 37. (c) 38. (c) 39. (d) 40. (c)
41. (a) 42. (c) 43. (c) 44. (a) 45. (d) 46. (d) 47. (a) 48. (a) 49. (d) 50. (c)
51. (c) 52. (c) 53. (b) 54. (a) 55. (a) 56. (b) 57. (c) 58. (d) 59. (d) 60. (c)
61. (b) 62.(b) 63. (b) 64. (d) 65. (c) 66. (b) 67. (c) 68. (a) 69. (d) 70. (c)
71. (a) 72. (c) 73. (c) 74. (a) 75. (b) 76. (c) 77. (c) 78. (c) 79. (b) 80. (c)
81. (b) 82.(d) 83. (b) 84. (b) 85. (c) 86. (b) 87. (c) 88. (b) 89. (b) 90. (a)
91. (c) 92. (c) 93. (a) 94. (b) 95. (c) 96. (a) 97. (b) 98. (d) 99. (d) 100. (a)
101. (c) 102.(b) 103.(b) 104.(c) 105.(a) 106.(a) 107.(d) 108.(c) 109.(d) 110. (c)
111. (a) 112.(b) 113.(d) 114.(a) 115.(d) 116.(a) 117.(b) 118.(d) 119.(a) 120. (a)
CASE-STUDY
Case Study
Of Computerized cab service management system
Cab service company employees are categorized into sections. Each section has asection manager.
Section No and a fixed basic salary rate is assigned to a section. They keep data onEmp-no, NIC No,
name, address, sex, DOB, contact no. of employees. If the employee is a driverhis driving licen no
and capable vehicle classes should be added . Each employee is assigned onlyto one section. For a
travel, driver is assigned to a vehicle. They keep following data about vehicles;Reg No, Insurance no,
Model, vehicle category, current mileage. In this case customer is the personwho is making a
reservation. They keep name, NIC_no, address, contact no. regarding the customer.Once a customer
reserved a cab, he cannot make any other reservations until the end of the reservedduration. Customer
can reserve one or more vehicles from a reservation. They are keeping index no,payment method,
amount, No. of vehicles, distance, start date and time, end date and time regardinga reservation. They
are supplying various kinds of supplies to maintain vehicles. A supplier cansupply more than one
supplying category. Company always keeps data on additional suppliers.Every supplier has a Reg No,
Name, address, contact no. A employee is responsible for one or moresupplying categories. They
keep data like cat_no, cat_description, cost per 1, quantity, net costregarding every supplying
category.
Employees
Vehicles
Customers
Cab Service MGTS system
Suppliers
Reservation
Employee(NIC No, Name, Address, Salary, Date of Birth, Sex, Employee ID, Contact No, licenseno,
capable vehicle category )Section(section No, Basic salary rate)vehicle(reg. No, Insurance No,
Model, vehicle category, current mileage)Customer(NIC No, Name, Address, Contact
No)Reservation(index No, no of vehicles, start date, start time, end date, end time, distance,
amount,payment method)Supply category(category no, category name, cost per 1, quantity, quantity,
net cost)supplier(Reg No, Name, Address, Contact No)
Bibliography