Yurttas/PL/DBL/mysql-f-2010/01/PC/q10.sql

From ZCubes Wiki
Revision as of 02:10, 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
10\. set-db.sql
11
12CREATE VIEW SmallRam(model,ram)
13  AS (SELECT model, ram
14      FROM PC
15      WHERE ram IN (SELECT MIN(ram)
16                    FROM  PC));
17
18SELECT P.maker
19FROM Product P, PC C, SmallRam S
20WHERE P.model=C.model
21  AND C.model=S.model
22  AND C.speed IN (SELECT MAX(speed)
23                  FROM PC, SmallRam S
24                  WHERE PC.model= S.model);