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

From ZCubes Wiki
Jump to navigation Jump to search
 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);