Anda di halaman 1dari 3

Department of CS&E, MIT, Manipal

II Test
VI Sem BE
CSE 342 Database Management Systems(Open Elective)
TIME : 1 HOUR

09-04-2014

MAX.MARKS : 20

Note: Make appropriate assumptions for any missing data


1. Multiple Choice Questions
1A. ______c_______ states that attributes A1, A2,Am together form a candidate key
a. Key(A1, A2,...Am) b. Candidate Key(A1, A2,...Am) c. Unique(A1, A2,...Am)
d. Check((A1,A2,Am) is unique))
1B. Attributes in select clause outside the aggregate functions must appear in __c____
list
a. from b. where c. group by d. order by
1C. X Y can be verified by __b__a(1/2)
a. X Minus Y b. not exists(X Minus Y) c. not exists(Y Minus X) d. exists(Y
Minus X)
1D. Attribute closure used in _d______b/c/d(1/2)
a. testing super key b. testing functional dependency c. computing closure of F
d. all of the above
1E. A view serializable schedule ____b/c_
a. is also conflict serializable b. need not be conflict serializable
c. may have blind writes d. is view equivalent to conflict serializable schedule(1X5)
2A. Illustrate the usage of tuple variables in accessing two different sub sets of same
Relation.
Ans:
select distinct T.branch_name
from branch as T, branch as S // T and S two subsets of relation of branch
where T.assets > S.assets and S.branch_city = Brooklyn
will find the names of all branches that have greater assets than some branch located in
Brooklyn.
(2)
2B. Consider the Employee relational database where the primary keys are underlined.
Employee(person_name, street, city)
Works(person_name, company_name, salary)
Company(company_name, city)
Manages(person_name, manager_name)
Give an expression in SQL to express each of the following queries:
i.
Find the names and cities of residence of all employees who earn more than
10,000 Rupees.
Ans:
Select person_name, city
From Employee e, Works w
Where e. person_name = w.person_name and w.salary > 10000;
(1)
ii.
Find the names of all employees in this database who live in the same city as
his /
her manager.
Ans:

Select e1. person_name


From Employee e1, Manages m, Employees e2
Where e1.person_name = m.person_name and e2.person_name = m.manager_name
And e1. City = e2. City; (1)
iii.
Find the name of the company with max. no. of employees
(2+(1+1+2))
Ans:
With NoOfEmps(cname, num) as select company_name, count(*) from works group
by company_name
Select cname from NoOfEmps where num >= (select num from NoOfEmps) (1+1)
3A. How the redundant information in tuples leads to different update anomalies?
Ans:
Consider the relation:
EMP_PROJ ( Emp#, Proj#, Ename, Pname, No_hours) -- employee info repeats
with projects
Modification Anomaly: Changing the name of project number P1 from
Billing to Customer-Accounting may cause this update to be made for all 100
employees working on project P1.
Insert Anomaly: Cannot insert a project unless an employee is assigned to .
Delete Anomaly: When a project is deleted, it will result in deleting all the
employees who work on that project. (1+.5+.5)
3B. Consider the Relational Schema given below.
Emp_Dept(Eid, EName, EAdress, Did, DName, Budget,Pid,PName, Period)
Suppose the following FDs exist: { Eid} {EName, EAdress};
{ Did} { DName Pid}; {Pid PName, Period}; {Period} {Budget}
Find the candidate key for Emp_Dept. Normalize it from 2NF to BCNF.
(2+3)
Ans:
CK {Eid, Did} as clolsure of {Eid, Did}is Emp_Dept. (1)
2NF: ED1{ Eid,EName, EAdress}
ED2 { Did,DName Pid,PName, Period,Budget} ED3{Eid,Did} (1)
3NF:ED21{ Did,DName Pid },ED22{Pid,PName, Period,Budget}
ED221{Pid,PName, Period}, ED222{Period,Bud (1)
4A. Give state diagram of a transaction.
Ans:

(2)
4B. How to check whether a concurrent schedule is correct or not? Explain.
(2+2)
Ans:
Serial execution of a set of transactions preserves database consistency. Thus,
a concurrent schedule is correct if it is serializable i.e., it is equivalent(conflict / view) to
a serial schedule. (1)

If a concurrent schedule S can be transformed into a serial schedule S by a series of


swaps of non-conflicting instructions, we say that S and S are conflict equivalent and S
is a correct schedule. (1)

Anda mungkin juga menyukai