Yurttas/PL/DBL/oracle/F/01/SPJ/q07.sql

From ZCubes Wiki
Jump to navigation Jump to search
 1REM
 2REM q07.sql
 3REM
 4REM Get project numbers for projects supplied with part 'P01'
 5REM in an average quantity greater than the greatest quantity
 6REM in which any part is supplied to project 'J01'.
 7REM
 8
 9SELECT DISTINCT jn
10FROM Shipments
11WHERE pn = 'P1'
12GROUP BY jn
13HAVING AVG(quantity) > (SELECT MAX(quantity)
14                        FROM Shipments
15                        WHERE jn='J01');