Yurttas/PL/DBL/postgres/F/01/Company-A/q01.sql

From ZCubes Wiki
Jump to navigation Jump to search
 1/*
 2REM
 3REM q01.sql
 4REM
 5REM Retrieve the names of employees in department 5
 6REM who work more than 10 hours per week on the
 7REM 'ProductX' project.
 8REM
 9*/
10
11SELECT current_schema();
12SET search_path to "companya";
13
14SELECT DISTINCT fname, minit, lname
15FROM Employee, Project, WorksOn
16WHERE Employee.dno = Project.dnum
17  AND Employee.ssn = WorksOn.essn
18  AND Project.pnumber = WorksOn.pno
19  AND Employee.dno = 5
20  AND hours > 10
21  AND pname = 'ProductX';