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

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 q07.sql REM REM Find the manufacturer(s) of the computer(PC or laptop) REM with the highest available speed...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
 1/*
 2REM
 3REM q07.sql
 4REM
 5REM Find the manufacturer(s) of the computer(PC or laptop)
 6REM with the highest available speed.
 7REM
 8*/
 9
10CREATE VIEW ProdSpeed(model, speed)
11  AS (SELECT model, speed
12      FROM PC
13      WHERE speed IN (SELECT MAX(speed)
14                      FROM  PC))
15     UNION
16     (SELECT model, speed
17      FROM Laptop
18      WHERE speed IN (SELECT MAX(speed)
19                      FROM  Laptop));
20
21SELECT P.maker, S.speed
22FROM Product P, ProdSpeed S
23WHERE P.model=S.model
24  AND S.speed IN (SELECT MAX(speed)
25                  FROM ProdSpeed);