0% found this document useful (0 votes)
14 views

Assignment-2

dbms

Uploaded by

suresh m
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Assignment-2

dbms

Uploaded by

suresh m
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

j Assignment-2 DBMS(D2+TD2)

1.suppose in relation schema R(NAME,DOB,CITY,DEPT),has the following functional


dependencies4
F={NAME->DOB, CITY; DOB->NAME,CITY; (DEPT,CITY)->DOB}
Find the candidate keys.Also find out the super key(s) which are not caisndidate keys.

2.Suppose in R(A, D,H,C,E) we have two sets of functional dependencies F1 and F2.
F1={ A->C; AC->D; E-AD; E->H } F2={ A->CD; E->H }
Check ,F1 and F2 are equivalent or not? Justify.

3.Check which highest normal form will be satisfied by the given relation along with the
provided functional dependencies (f.d).
R(A,B,C,D,E,F,G,H,I,J) and f.d={ AB->C; AD->GH; BD->EF; A->I; H->J }
Also ,Decompose the table into its next higher normal form.

4.

Write the queries in SQL to achieve the following :


a. Find the fname and lname of all such male employees who have salary greater than all
employees from department number.
b. Retrieve fname, lname, ssn of such employees who have no dependents.
c. Find social security number of the employees who have no dependents.
d. Calculate average work done by each of the employees(in hours).
e. Write the syntax to create the table WORKS_ON as mentioned above. After creating
the table, add another column named as JobLoaction.

1|Page
5.Consider the following realtions with their attributes:
EMPLOYEE(fname,lname,ssn,sex,salary,super_ssn,dno,address,birth_date)
PROJECT(Pname,Pnumber,Plocation,Dnum)
WORKS_ON(Essn,Pno,Hours)
Draw the initial query tree for the following SQL query.Then apply heuristic query
optimization on that initial query tree to find the final query tree(if any) that is efficient to
execute.
SELECT E.ssn,P.Pname,E.salary FROM EMPLOYEE AS E,WORKS_ON AS W,PROJECT
AS P WHERE E.Ssn=W.Essn AND W.Pno=P.Pnumber AND P.location=’Guntur’ AND
E.sex=’female’;

6. What is normalization? What are the conditions required for a relation to be in 3NF and
BCNF. What is the difference between 3NF and BCNF explain with example.
7.Define Query processing?what are the different steps involved in query processing with
neat Diagram.

A) select fname lname from employee

where salary > all(select salary from employee where dno=5);

Retrieve the names of employees who have nodependents.


SELECTFNAME, LNAMEFROMEMPLOYEEWHERENOT
EXISTS(SELECT*FROMDEPENDENTWHERESSN=ESSN) ;

To increase salary of employees in percentage write this sql query.

‘UPDATE employees SET salary= salary + (salary * 10 / 100) WHERE salary > 12000’;

‘UPDATE employees SET salary= salary + (salary * 10 / 100) WHERE salary between 12000
and 20000’;

2|Page

You might also like