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

 1/*
 2REM
 3REM q05.sql
 4REM
 5REM Retrieve the names of employees who work on every project.
 6REM
 7*/
 8
 9SELECT current_schema();
10SET search_path to "companya";
11
12SELECT DISTINCT E1.fname, E1.minit, E1.lname
13FROM Employee E1
14WHERE NOT EXISTS (SELECT pno
15                  FROM WorksOn
16                  WHERE pno NOT IN (SELECT pno
17                                    FROM Employee E2, WorksOn
18                                    WHERE essn = E2.ssn
19                                      AND E2.ssn = E1.ssn));