Yurttas/PL/DBL/mssql/F/01/PC/q10.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 q10.sql REM REM Find the maker of the printer with the fastest processor REM among all those PC's that have...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
 1/*
 2REM
 3REM q10.sql
 4REM
 5REM Find the maker of the printer with the fastest processor
 6REM among all those PC's that have the smallest amount of RAM.
 7REM
 8*/
 9
10CREATE VIEW SmallRam(model,ram)
11  AS (SELECT model, ram
12      FROM PC
13      WHERE ram IN (SELECT MIN(ram)
14                    FROM  PC));
15
16SELECT P.maker
17FROM Product P, PC C, SmallRam S
18WHERE P.model=C.model
19  AND C.model=S.model
20  AND C.speed IN (SELECT MAX(speed)
21                  FROM PC, SmallRam S
22                  WHERE PC.model= S.model);