CREATE MATERIALIZED VIEW nov_2001 
BUILD IMMEDIATE REFRESH COMPLETE 
ENABLE QUERY REWRITE AS 
SELECT cust_id, prod_id, time_id, sum(amount_sold) AS dollars 
FROM sales s 
WHERE time_id >= TO_DATE('01-NOV-2001','DD-MON-YYYY') AND 
time_id <= TO_DATE('30-NOV-2001','DD-MON-YYYY') 
GROUP BY time_id, cust_id, prod_id; 

CREATE MATERIALIZED VIEW dec_2001 
BUILD IMMEDIATE REFRESH COMPLETE 
ENABLE QUERY REWRITE AS 
SELECT cust_id, prod_id, 
time_id, sum(amount_sold) AS dollars 
FROM sales s 
WHERE time_id >= TO_DATE('01-DEC-2001','DD-MON-YYYY') AND 
time_id <= TO_DATE('31-DEC-2001','DD-MON-YYYY') 
GROUP BY time_id, cust_id, prod_id; 
