Yurttas/PL/DBL/postgres/F/01/SPJ/q14.sql

From ZCubes Wiki
Jump to navigation Jump to search
 1/*
 2REM
 3REM q14.sql
 4REM
 5REM Construct a table containing a list of project numbers
 6REM for projects that are either located in 'London' or are
 7REM supplied by a 'London' supplier.
 8REM
 9*/
10
11SELECT current_schema();
12SET search_path to "spj";
13
14CREATE TABLE LondonProjs (JN VARCHAR(4));
15    
16INSERT INTO LondonProjs
17(SELECT T.JN
18 FROM Shipments T, Suppliers S
19 WHERE T.SN = S.SN
20   AND S.CITY = 'London')
21UNION
22(SELECT JN
23 FROM Projects
24 WHERE CITY = 'London');