Query
-- Best month of the year in terms of
-- minutes of usage for each year of operation.
SELECT Calendar_Year,
Calendar_Year_Month,
SUM(Total_Minutes) AS Total_Minutes
FROM Billing_Fact,
Date_Dimension
WHERE Billing_Fact.Date_Key = Date_Dimension.Date_Key
GROUP BY Calendar_Year,Calendar_Year_Month
ORDER BY Calendar_Year,
Calendar_Year_Month;
Example
Calendar_Year | Calendar_Year_Month | Total_Minutes
--------------+---------------------+---------------
2000 | 1 | 1451
2000 | 2 | 1616
2000 | 3 | 1397
2000 | 4 | 1334
2000 | 5 | 1076
(17 rows)