Yurttas/PL/DBL/postgres/F/01/PC/q10.sql
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);