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