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

From ZCubes Wiki
Revision as of 00:43, 5 November 2013 by MassBot1 (talk | contribs) (Created page with "<syntaxhighlight lang="sql" line start="1" enclose="div">/* REM REM q05.sql REM REM Find all employees who live in the same City and REM on the same Street as their Manager. R...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
 1/*
 2REM
 3REM q05.sql
 4REM
 5REM Find all employees who live in the same City and
 6REM on the same Street as their Manager.
 7REM
 8*/
 9
10SELECT current_schema();
11SET search_path to "companyb";
12
13SELECT E1.employeename 
14FROM Employee E1, Manages M, Employee E2 
15WHERE E1.employeename = M.employeename 
16  AND M.managername = E2.employeename 
17  AND E1.Street = E2.Street 
18  AND E1.City = E2.City;