Example: Window with multiple functions

It is possible to define a single (named) window and compute multiple function results over it, as the following example demonstrates.

SELECT p.id, p.description, s.quantity, s.ship_date,
  SUM(s.quantity) OVER ws1, MIN(s.quantity) OVER ws1
FROM sales_order_items s JOIN product p ON (s.prod_id =
  p.id) WHERE s.ship_date BETWEEN '1994-05-01' AND
  '1994-08-31' AND  s.quantity > 40 window ws1 AS
  (PARTITION BY prod_id ORDER BY ship_date rows
  between unbounded preceding and current row) 
ORDER BY p.id;

The following are the results from the above query:

ID   description   quantity   ship_date    sum   min
---  -----------   --------   -----------  ---   ---
302  Crew Neck           60    1994-07-02   60    60
400  Cotton Cap          60    1994-05-26   60    60
400  Cotton Cap          48    1994-07-05  108    48
401  Wool cap            48    1994-06-02   48    48
401  Wool cap            60    1994-06-30  108    48
401  Wool cap            48    1994-07-09  156    48
500  Cloth Visor         48    1994-06-21   48    48
501  Plastic Visor       60    1994-05-03   60    60
501  Plastic Visor       48    1994-05-18  108    48
501  Plastic Visor       48    1994-05-25  156    48
501  Plastic Visor       60    1994-07-07  216    48
601  Zipped Sweatshirt   60    1994-07-19   60    60
700  Cotton Shorts       72    1994-05-18   72    72
700  Cotton Shorts       48    1994-05-31  120    48