Yurttas/PL/DBL/postgres/F/01/PC/q06.sql

Revision as of 23:48, 4 November 2013 by MassBot1 (talk | contribs) (Created page with "<syntaxhighlight lang="sql" line start="1" enclose="div">/* REM REM q06.sql REM REM Find those manufacturers of at least two different REM computers (PC's or laptops) with spe...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
 1/*
 2REM
 3REM q06.sql
 4REM
 5REM Find those manufacturers of at least two different
 6REM computers (PC's or laptops) with speeds of at least 133.
 7REM
 8*/
 9
10SELECT current_schema();
11SET search_path to "pc";
12
13SELECT maker
14FROM Product
15WHERE model IN ( (SELECT P.model
16                  FROM Product P, PC
17                  WHERE P.model=PC.model
18                    AND PC.speed>=133)
19                  UNION
20                 (SELECT P.model
21                  FROM Product P, Laptop L
22                  WHERE P.model=L.model
23                    AND L.speed>=133) )
24GROUP BY maker
25HAVING COUNT(model)>=2;