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

From ZCubes Wiki
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 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
10SELECT current_schema();
11SET search_path to "pc";
12
13CREATE VIEW SmallRam(model,ram)
14  AS (SELECT model, ram
15      FROM PC
16      WHERE ram IN (SELECT MIN(ram)
17                    FROM  PC));
18
19SELECT P.maker
20FROM Product P, PC C, SmallRam S
21WHERE P.model=C.model
22  AND C.model=S.model
23  AND C.speed IN (SELECT MAX(speed)
24                  FROM PC, SmallRam S
25                  WHERE PC.model= S.model);