Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Specify the following queries on the COMPANY relational database schema (SQL) (a

ID: 3738759 • Letter: S

Question

Specify the following queries on the COMPANY relational database schema (SQL)

(a) Retrieve the names of employees in department 5 who work more than 10 hours per week on the 'ProductX' project.

(b) List the names of employees who have a dependent with the same first name as themselves.

(c) For each project, find the total spent hourse by all employess

(d) For each project, list the names of projects the have total spent hours (spent by all employees) less than the average spent hours of all projects.

(e) Retrieve the names of employees who work on every project contolled by Research department.

(f) Find the names and addresses of employees who work on at least one project located in Houston but whose department has no location in Houston.

(g) List the last names of department managers who have no dependents.

EMPLOYEE Fname Minit Lname Ssn Bdate Address SexSalary Super_ssn Dno DEPARTMENT Dname Dnumber Mgr ssn Mgr _start_date DEPT LOCATIONS Dnumber Dlocation PROJECT PnamePnumber Plocation Dnum WORKS ON Essn Pno Hours DEPENDENT Essn Dependent_name Sex Bdate Relationship

Explanation / Answer

A) SELECT E.Fname FROM EMPLOYEE E, DEPARTMENT D, PROJECT P, WORKS_ON W WHERE E.Dno=M.Dnumber AND M.Dnumber=P.Dnum AND P.Pnumber=W.Pno AND D.Dnumber=5 AND W.Hours=10 AND P.Pname='ProductX';


B) SELECT E.Fname FROM EMPLOYEE E, DEPENDENT DP WHERE E.Ssn=DP.Essn AND DP.Dependent_name=E.Fname;

C)SELECT P.PNAME,SUM(HOURS)FROM PROJECT P, WORKS_ON W WHERE P.PNUMBER=W.PNOGROUP BY P.PNAME;


E) SELECT E.Fname FROM EMPLOYEE E, DEPARTMENT D, PROJECT P WHERE E.Dno=M.Dnumber AND M.Dnumber=P.Dnum AND D.Dname='Research';

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote