0% found this document useful (0 votes)
12 views3 pages

Vignan's Foundation For Science, Technology and Research (Deemed To Be University)

Uploaded by

ydsai07
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views3 pages

Vignan's Foundation For Science, Technology and Research (Deemed To Be University)

Uploaded by

ydsai07
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Vignan’s Foundation for Science, Technology

and Research (Deemed to be University)

DEPARTMENT: COMPUTER SCIENCE AND


ENGINEERING
II - YEAR
Sec – A

Batch No: 01
Subject: DBMS
Subject Code: 22CS201
Target 3 Report Submission

Submitted to:
Dr. MD. OQAIL AHAMAD
Assistant Professor
Department of CSE
VFSTR

Submitted by

Registration No: 231FA04031


Registration No:231FA04033
Registration No:231FA04036
Registration No:231FA04F03
QUESTION : Bank Corporation and earn more than Rs.
10,000:
Consider the employee database given
below. SELECT E.Employee_Name, E.Street,
E.City
EMPLOYEE (Employee-Name, Street,
FROM EMPLOYEE E
City)
JOIN WORKS W ON E.Employee_Name =
WORKS (Employee-Name, Company- W.Employee_Name
Name, Salary)
WHERE W.Company_Name = 'First Bank
COMPANY (Company-Name, City) Corporation'
AND W.Salary > 10000;
MANAGES (Employee-Name, Manager-
Name)

A. Develop SQL query for each of the ii. Find companies whose employees earn a
following statements: higher salary, on average, than the
average salary at First Bank Corporation:
i. Find the names, street address, and cities
of residence of all employees who work SELECT W1.Company_Name
for First Bank Corporation and earn more FROM WORKS W1
than Rs. 10,000.
GROUP BY W1.Company_Name
ii. Find those companies whose employees
earn a higher salary, on average, than the HAVING AVG(W1.Salary) > (
average salary at First Bank Corporation. SELECT AVG(W2.Salary)

iii. Find all employees in the database who FROM WORKS W2


earn more than every employee of Small
Bank Corporation. WHERE W2.Company_Name = 'First
Bank Corporation'
B. Create a view named );
EmployeeManagerView that shows the
Employee Name and their Manager Name.
Write the SQL to create this view.
iii. Find employees who earn more than
C. Determine whether the EMPLOYEE and every employee of Small Bank
COMPANY relations are in Third Normal Corporation:
Form (3NF). Are there any transitive SELECT E.Employee_Name
dependencies? If so, explain how to bring
them to 3NF. FROM WORKS E
WHERE E.Salary > (
SELECT MAX(S.Salary)
ANSWER:
FROM WORKS S
i. Find the names, street addresses, and
cities of employees who work for First WHERE S.Company_Name = 'Small
Bank Corporation'
);

B. Create EmployeeManagerView:
CREATE VIEW EmployeeManagerView AS
SELECT Employee_Name, Manager_Name
FROM MANAGES;

C. Are EMPLOYEE and COMPANY in


3NF?
 EMPLOYEE (Employee_Name,
Street, City):
o Key: Employee_Name
o Dependencies:
Employee_Name → Street,
City
o 3NF Status: Already in 3NF.
No transitive dependencies.
 COMPANY (Company_Name,
City):
o Key: Company_Name
o Dependencies:
Company_Name → City
o 3NF Status: Already in 3NF.
No transitive dependencies.

Conclusion: Both EMPLOYEE and


COMPANY are in 3NF and don’t need
further normalization.

You might also like