Download as pdf or txt
Download as pdf or txt
You are on page 1of 20

/*•

syi
m.
No.of
For Office Use Only
Question Paper Code
Copies
^' I

Remarks on Scrutiny

No. of pages Page No.

FOURTH SEMESTEIjB.Sc./ BC A DEGREE EXAMINATIONS


CAREER RELATED FDP UNDER CBCSS X

Group2(b)-COMPUTER SCIENCE/ COMPUTER APPLICATIONS

Core Course- CS 1442/CP 1443.


DATABASE MANAGEMENT SYSTEMS

(2014 Admission Onwards)

Time:3 hours Total Marks: 8Q/

ANSWER KEY
I
*

l
•v
<
v

DBMS Answer Key - set 2


SECTION- A [Very Short Answer Type]
(10*1=10 Marks) .
1. Application programmers - interact with system through DML calls.

2. The ability to modify a schema definition in one level without affecting a schema
definition in the next higher leveljs called data independence.

.3. A relationship is an association among several entities.

4. Instance- the actual content of the database at a particular point in time.

5. An entity is represented by a set of attributes, that is descriptive properties possessed by


all members ofan entity set. Example: loan - (loan-number, amount)

6: Super Key: Set of attributes (one or more) that collectively identifies an entity in an entity
set.. ■

7. Metadata is the information about the database.

8. trivial: If an FD X —»Y holds where Y subset of X, then it is called a trivial FD. Trivial FDs
are always hold.

9. A.relation r (R) is said to be in first normal form (1NF), if and only if every entry of the
relation has at most a single value.

10. Consistency property ensures that a complete transaction takes a database from one
consistent state to another consistent state. If a transaction fails even then the database
should come back to a consistent state.

SECTION - B [Short Answer]

8*2=16 Marks
11. One-to-one :-When 6nly one instance of entity is associated with the relationship, it is '
marked as T. This image below reflects that only 1 instance of each entity should be
associated with the relationship. It depicts one-to-one relationship
One-to-many :-When more than one instance of entity is associated with the relationship, it
is marked as 'N1. This image below reflects that only 1 instance of entity on the left and
more than, one instance of entity on the right can be associated with the relationship. It
depicts one-to-many relationship
Many-to-one :-When more than one instance of entity is associated with the relationship, it
is marked as 'N'. This image below reflects that more than one instance of entity on the left
and. only one instance of entity;on the right can be associated with the relationship. It
depicts many-to-one relationship
■ Many-to-many ;-This image below reflects that more than one instance of entity on the left
and more than one instance of entity on the right can be associated with the relationship: It
depicts many-to-many relationship

12. Physical Database Schema: This schema pertains to the actual storage of data and its
form of storage Nke files, indices etc. It defines the how data will be stored in secondary
»

A
<
. V .

storage etc. Logical Database Schema: This defines all logical constraints that need to be
applied on data stored. It defines tables, views and integrity constraints etc.

13. Total Participation: Each entity in the entity is involved in the relationship. Total
participation is represented by double lines.
i. •
14. STORED ATTRIBUTE:-Attributes -that are directly stored in the database are called
stored attributes. For example, Birth Date attribute of a STUDENT entity.

DERIVED ATTRIBUTE:- Attributes that are not stored directly but can be derived from
stored attributes are called derived attribute. For example, The Age of a STUDENT entity
can be derived from the current date and the Birth Date of the student.

15. INSERT INTO table (columnl [, column2, columns ... ]) VALUES (valuel [, value2,
values...]);
INSERT INTO book (Author, Subject) VALUES ("anonymous'', "computers");

16. The Natural-Join Operation:-The natural join is a binary operation that allows to
combine certain selections and a Cartesian product into one operation. It is denoted by the
“join” symbol |x|. The natural-join operation forms a Cartesian product of its two
arguments, performs a selection forcing equality on those attributes that appear in both
relation schemas, and finally removes'duplicate attributes.

17. Information about the users, privileges and the internal structure of the database.
Pr/V/7eges mean the permissions of each user to access the database

18. Physical level:: how the data is actually stored


• Logical level :what data are stored in the database and what relationship exists
among those data

19. Physical data independence: is the ability to modify the physical schema without
. causing application programs to be rewritten.
Logical data independence: is the ability to modify the logical schema without causing
application to be rewritten.

20. Procedural DML: require a user to specify what data are needed and how to get those
data. .'V ■
• Non-procedural DML: require a user to specify what are needed without specifying
how to get those data.

2T. A relation r (R) is in Boyce-Codd form (BCNF) if and only if the following conditions are
met simultaneously
1. The relation is in 3NF
2. For every functional dependency X->A, we have that either Ac: X or X is a
super key of r.
In other words, every functional dependency is a trivial dependency or if it is not
trivial dependency then X must be a super key.

*•
I

>
/
V .
22. A relation R is in Second Normal Form (2NF) if and only if two conditions are met
simultaneously:
1. R is already in 1NF
2. No nonprime attribute is partially dependent on any key or equivalently, each
nonprime attribute in R is fully dependent upon every key

SECTION - C [Short Essay]


6*4=24 Marks
23. Atomicity
It defines a transaction to be a single unit of processing. In other words, either a
transaction will be done completely or not at all.

• Consistency
This property ensures that a complete transaction takes a database from one
consistent state to another consistent state. If a transaction fails even then the
database should come back to a consistent state.

• Isolation or.'lndependence
The isolation property states that the updates of a transaction should not be visible
till they are committed. Isolation guarantees that the progress of a transaction do not
affect the outcome of another transaction.

•. Durability or Permanence
This property necessitates that once a transaction has committed, the changes
made by it be never lost because of subsequent failure.

24. Database administrator's duties include:


Schema definition
Storage structure and access method definition
Schema and physical organization modification
Granting user authority to access the database
Specifying integrity constraints
Acting as liaison with users
Monitoring performance and responding to changes in requirements

\.

25.
>
i
I C usee 3
I
I
I
client i
t
i application client
i

network
-i.
i
i
i application server
r
server . i
i
i
i
database system

b. three-tier architecture

Database (Data) Tier: At this tier, only


database resides. Database along with its
query processing languages sits, in layer-3
of 3-tier architecture. It also contains all
relations and their constraints.
Application (Middle) Tier: At this tier
the application server and program, which
access database, resides. For a user this
application tier works as abstracted view
of database. Users are unaware of any
existence of database beyond application.
For database-tier, application tier is the
user of it. Database tier is not aware of
any other user beyond application tier.
This tier works as mediator between the
two.
User (Presentation) Tier: An end user
sits on this tier. From a user’s aspect this
tier is everything. He/she doesn't know
about any existence or form of database
beyond this layer. At this layer multiple
views of database can be provided by the
application. All views are generated b^
applications, which reside in application
tier

26. Every relation has some conditions that must hold for it to be a valid relation. These
conditions are called Relational Integrity Constraints. There are three main integrity
constraints.
Key Constraints
1
t

I
Domain constraints
Referential integrity constraints
>.
Key Constraints:
There must be at least one minimal subset of attributes in the relation, which can identify a
tuple uniquely. This minimal subset of attributes is called key for that relation. If there are '
more than one such minimal subsets, these are called candidate keys. Key constraints
forces that:
in a relation with a key attribute, no two tuples can have identical value for key attributes, .
key attribute can not have NULL values.
Domain constraints
Attributes have specific values in real-world scenario. For example, age can only be
positive integer. The same constraints has been tried to employ on the attributes of a
relation. Every attribute is bound to have a specific range of values. For example, age can
not be less than zero and telephone number can not be a outside 0-9.
Referential integrity constraints
This integrity constraints works on the concept of Foreign Key. A key attribute of a relation
can be referred in other relation, where it is called foreign key.
Referential integrity constraint stated that if a relation refers to a key attribute of a different
or same relation, that key element must exists.
27.
The tuple relational calculus attribute’s domain rather than
It is a nonprocedural query language. values for an entire tuple.
A query in the tuple relational calculus is • Formal definition :
expressed as • An expression is in the domain
{t | P (t)} i.e. it is the set of all tuples t such relational calculus is of the form
that predicate P is true for t. • { < X1, X2.......Xn> | P (X1, X2,
Example: to find the Branch name, loan ........... Xn)}
number and amount for loans over 1200: • whereX1,X2,...Xn represents
(t |t e loan A t [amount] >1200} domain variables.
. 3 T e r (Q (t)) means An atom in the domain relational calculus
"there exists a tuple t in relation r such has one of the following forms .
that predicate Q (t) is true” • < X1, X2, ....,Xn> e r, where
A tuple relational calculus expression is of r is a relation on n attributes
the form . and X1, X2......,Xn are
{11 P (t)} Where P is a formula. domain variables or domain
A tuple variable js said to be a free constants
variable unless it is qualified bv 3 or V • X 0 y where x and y are
A tuple relational calculus formula is built domain variables and 0 is a
up of atoms. An atom has one of the comparison operator.
following forms
• .
s e r where s is a tuple variable

• X 0 c where x is a domain
and r is a relation variable and c is a constant
• s [x] 0 u [y] where s and u are tuple
variables 0 is a comparison
operator ( <, £, >, £,=,*)
• s [x] © c where c is a constant
The domain relational calculus
• This form uses domain variables
that take on values from an
/
I t
I
I

.r «
28. ALTER TABLE tablename {ADD | MODIFY} ( columnname datatype [ {ADD | MODIFY}
columnname datatype]);
The ALTER TABLE command can also be used to add table constraints. In those cases,
the syntax would be:
ALTER TABLE tablename ADD constraint [ ADD constraint ];
We could also use the ALTER TABLE command to remove a column or table constraint.
The syntax would be as follows:.
ALTER TABLE tablename DROP{PRIMARY KEY | COLUMN columnname \ CONSTRAINT
cpnstraintname};
When removing a constraint, we need to specify the name given to the constraint.

29. Transitive dependency ^•


If an attribute is indirectly dependent on primary key, then we say, there exists a transitive
dependency.
For example:
If A-^B, B-^C then by transitivity theorem A-> C.
i.e. If A is the primary key, C is transitively dependent on A and functionally dependent on B
which is a nonprime attribute.
Third normal form
A relation r (R) is in third normal form (3NF) if and only if the following conditions are
satisfied simultaneously.
1. R (R) is already in 2NF
2. No non-prime attribute is transitively dependent on the key
or
No non-prime attribute functionally determines any other non-prime attribute

30. Insertion anomaly: we cannot insert information of a new entity, if value of some field is
not available. Deletion anomaly: If we delete an entity, some information of data base lost.
Update anomaly: If we update an entity, any of the instance of that entity not update.
Consider the schema project_employee(ProjJD,EmpJD,
Emp_name,Emp_dept,Emp_hrly_rate,tbtal_hrs)
Insertion anomaly: we cannot insert information about any new employee, if he is not
assigned to a project.
Deletion anomaly: if a project is over, and removed from the table, the connection between
the employee and department is also lost.
Update anomaly: an employee may appear many times in the table. If an employee is
moved to another department, we have to search each entry in the table to update it.

31. CREATE TABLE tablename (columnl data type [constraint] [,column2 data type
[constraint] ] [.PRIMARY KEY (columnl [, column2]) ] [.FOREIGN KEY (columnl [,
column2]) REFERENCES tablename] [.CONSTRAINT constraint ]);
The NOT NULL constraint ensures that a column does not accept nulls.
_The UNIQUE constraint ensures that all values in a column are unique.
_ The DEFAULT constraint assigns a ^alue to an attribute when a new row is added to a
table. The end user may, of course, enter a value other than the default value.
_ The CHECK constraint is used to validate data when an attribute value is entered. The
CHECK constraint does precisely what its name suggests: it checks to see that a specified
condition exists.
CREATE TABLE INVOICE (INV_NUMBER NUMBER PRIMARY KEY,
'*r

2
CUS_CODE NUMBER NOT NULL REFERENCES CUSTOMER(CUS_CODE),
INV_DATE DATE DEFAULT SYSDATE NOT NULL,CONSTRAINT INV_CK1 CHECK
(INV_DATE > TO_DATE('01-JAN-201 OVDD-MON-YYYY')));
SECTION - D [LONG ESSAY]
[Answer any TWO questions. Each question carries 15 marks]
15*2=30 Marks
32
. Relational algebra Duplicate rows are automatically
Relational algebra is a procedural query eliminated, as relation is a set.
language, which takes instances of for example;
relations as input and yields instances of risubject, author
relations as output. It Uses operators to (Books)
perform queries. An operator can be Union Operation (U)
either unary or binary. They accept Union operation
relations as their input and yields relations performs binary
as their output. Relational algebra is union between two
performed recursively on a relation and given relations and is
intermediate results are also considered defined as: r u s = {t
relations.
11 e r or t e s}
Fundamental operations of Relational
algebra: FI author (Books) u n
Select author (Articles)
Cartesian Product (X)
Project Combines information of two different
Union relations into one.
Notation: r Xs
Set different Where r and s are relations and there
output will be defined as:
Cartesian product
r X s = { q t | q e r and t e s} IT author =
Rename 'Rajaraman’(Books X Articles)
Output: yields a relation as result which
These are defined briefly as follows: shows all books and articles written by
Select Operation (o) Rajaraman.
Selects tuples that satisfy the given Rename operation ( p)
predicate from a relation. Results of relational algebra are also
Notation cjp(r) relations but without any name; The
Where p stands for selection predicate rename operation allows us to rename the
and r stands for relation, p is prepositional output relation, rename operation is
logic formulae which may use connectors denoted with small greek letter rho p
like and, or and not. These terms may use Notation: p x (E)
relational operators like: =, £, < , >, < Where the result of expression E is saved
For example: with name of x.
osubject-'database"(B Additional operations are:
ooks) Set intersection
Project Operation (II)
Projects column(s) that satisfy given Assignment
predicate. Natural join
Notation: nA1, A2, An (r)
Where a1, a2 , an are attribute names of
relation r.

i. •
t

I
».
33. DML commands -insert, select, update and delete.
INSERT INTO tablename VALUES
(valuel, value2,, valuen)]
INSERT INTO VENDOR
VALUES (21225,'Bryson,
Inc.','Smithson','615',’223-3234',TN'.'Y');
SELECT columnlist FROM tablename;
. SELECT * FROM PRODUCT;
UPDATE tablename
SET columnname = expression [,
columnname = expression] [WHERE
conditionlist ];
UPDATE PRODUCT
SET PJNDATE = '18-JAN-2010',
P_PRICE = 17.99, P_MIN = 10 ;
WHERE P_CODE = '13-Q2/P2';
DELETE FROM tablename
[WHERE conditionlist ];
DELETE FROM PRODUCT
WHERE P_CODE = ’BRT-345';

34. The managerial services of the DBA function include at least: supporting the end-user
. community; defining and enforcing policies, procedures, and standards for the database
function; ensuring data security, privacy, and integrity; providing data backup and recovery
services; and monitoring the distribution and use of the data in the database.
The technical role requires the DBA to be involved in at least these activities: evaluating,
selecting, and installing the DBMS; designing and implementing databases and
applications; testing and evaluating databases and applications; operating the DBMS,
utilities, and applications; training and supporting users; and maintaining the DBMS,
utilities, and applications.
Security refers to activities and qieasures to ensure the confidentiality, integrity, and
availability of an information system and its main asset, data. A security policy is a
collection of standards, policies, and practices created to guarantee the security of a
system and ensure auditing and compliance.
A security vulnerability is weakness in a system component that could be exploited to
allow unauthorized access or service disruption. A security threat is an imminent security
violation caused by an unchecked security vulnerability. Security vulnerabilities exist in all .
components of an information system: people, hardware, software, network, procedures,
and data. Therefore, it is critical to have robust database security. Database security refers
to the use of DBMS features and related measures to comply with the security
requirements of the organization.

35. The term normalization refers to a reversible step by step process in which a given set
of relations is replaced by successive collections of relations that have a progressively
simpler and more regular structure
• . Each step referred to as normal form, defines a set of criteria that needs to be met
by the different tables of the database. Since the process is reversible, the original
set of relations can be recovered with no loss of information.
Design Goals: Avoid redundant data
t

4
r

»
t
s

Ensure that relationships among attributes are represented


-Facilitate the checking of updates for violation of database integrity
constraints.
The objectives of the normalization process are:
1. To make it feasible to represent any relation in the database.
2. To obtain powerful relational retrieval algorithms based on a collection of primitive
relational operators
3. To free relations under undesirable insertion, update and deletion anomalies.
4. To reduce the need for reconstructing the relations as data types are introduced.
. The entire normalization process' is; based upon the analysis of relations, their schemes t
their primary keys and their functional dependencies. Whenever a relation does not
meet the criteria, it is decomposed into some other relations that individually meet the
criteria of the normal form test.
E F Codd proposed three normal forms called 1NF, 2NF and 3NF. In addition, there exists,
Boyce-Codd Normal form 4NF and 5NF.
Lossless or lossy decompositions
Whenever a relation is decomposed it is necessary to ensure that the data in the original
relation is represented by the data in the relations which are the results of the
decomposition, i.e. we must be able to recover the original relation from the relations that
have replaced it.
If we can recover the original relation then, we say the decomposition is lossless with
respect to D where D is the set of FDs satisfied by the original relation.
If the relation cannot be recovered it is called lossy decomposition
K V • T, , Ri X ,V V

V* 1, «*
Kj v» «> ** c*
\.

y>
?•
a.
C> •i

a.

yj

yj X*

a.jeto a.

f , . X V tX.

«1 yi
*». - - Xj y» e.

y. *•
t , - -'i.. •p’a\l

x* y>

The natural join of relations R1 and R2


has tuples that were not in the original
relations. These additional tuples are
called spurious tuples because they
represent false information that is not
y.
valid.
I

tl

!
I

You might also like