Yurttas/PL/DBL/postgres/F/01/PC/q16.sql

Revision as of 23:48, 4 November 2013 by MassBot1 (talk | contribs) (Created page with "<syntaxhighlight lang="sql" line start="1" enclose="div">/* REM REM q16.sql REM REM Find those pairs of PC models that have both REM the same speed and RAM. A pair should be l...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
 1/*
 2REM
 3REM q16.sql
 4REM
 5REM Find those pairs of PC models that have both
 6REM the same speed and RAM. A pair should be listed only once;
 7REM e.g., list(i,j) but not (j,i).
 8REM
 9*/
10
11SELECT current_schema();
12SET search_path to "pc";
13
14SELECT DISTINCT P1.model, P2.model
15FROM PC P1, PC P2
16WHERE P1.ram=P2.ram
17  AND P1.speed=P2.speed
18  AND P1.model>P2.model;