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

From ZCubes Wiki
Revision as of 04:35, 3 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)
Jump to navigation Jump to search
 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 maker
11FROM Product
12WHERE model IN ( (SELECT P.model
13                  FROM Product P, PC
14                  WHERE P.model=PC.model
15                    AND PC.speed>=133)
16                  UNION
17                 (SELECT P.model
18                  FROM Product P, Laptop L
19                  WHERE P.model=L.model
20                    AND L.speed>=133) )
21GROUP BY maker
22HAVING COUNT(model)>=2;