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

Revision as of 00:55, 5 November 2013 by MassBot1 (talk | contribs) (Created page with "<syntaxhighlight lang="sql" line start="1" enclose="div">/* REM REM q14.sql REM REM Construct a table containing a list of project numbers REM for projects that are either loc...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
 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');