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

 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);