Yurttas/PL/DBL/oracle/F/01/SPJ/q03.sql
Jump to navigation
Jump to search
1REM
2REM q03.sql
3REM
4REM Get supplier numbers for suppliers supplying some project
5REM with part 'P02' in a quantity greater than the
6REM average shipment quantity of part 'P02' for that project.
7REM
8
9SELECT DISTINCT S.sn
10FROM Shipments S
11WHERE pn = 'P2'
12 AND quantity > (SELECT AVG(T.quantity)
13 FROM Shipments T
14 WHERE pn = 'P2'
15 AND S.jn = T.jn);