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

From ZCubes Wiki
Jump to navigation Jump to search
 1/*
 2REM
 3REM q09.sql
 4REM
 5REM Find the names and the addresses of employees who work
 6REM on at least one project located in 'Houston' but whose
 7REM department has no location in 'Houston'.
 8REM
 9*/
10
11SELECT current_schema();
12SET search_path to "companya";
13
14SELECT DISTINCT fname, lname, address, dno
15FROM Employee, WorksOn, Project, DeptLocation
16WHERE ssn = essn
17  AND pno = pnumber
18  AND plocation = 'Houston'
19  AND dno = dnumber
20  AND dlocation <> 'Houston';