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

Revision as of 23:03, 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 speed...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
 1REM
 2REM q06.sql
 3REM
 4REM Find those manufacturers of at least two different
 5REM computers (PC's or laptops) with speeds of at least 133.
 6REM
 7
 8SELECT maker
 9FROM Product
10WHERE model IN ( (SELECT P.model
11                  FROM Product P, PC
12                  WHERE P.model=PC.model
13                    AND PC.speed>=133)
14                  UNION
15                 (SELECT P.model
16                  FROM Product P, Laptop L
17                  WHERE P.model=L.model
18                    AND L.speed>=133) )
19GROUP BY maker
20HAVING COUNT(model)>=2;