Book Contents

Book Index

Next Topic

Home

telecom_query_05.sql

Query

-- Total number of calls with abnormal termination code

SELECT Calendar_Year,

Termination_Description,

SUM(Number_Of_Calls) AS CALL_COUNT

FROM Billing_Fact Bill_Fact,

Date_Dimension Date_Dim,

Call_Termination_Dimension Term_Dim

WHERE Bill_Fact.Date_Key = Date_Dim.Date_Key

AND Bill_Fact.Termination_Key = Term_Dim.Termination_Key

AND Term_Dim.Termination_Type = 'Abnormal'

GROUP BY Calendar_Year,Termination_Description

ORDER BY Calendar_Year,

CALL_COUNT;

Example

Calendar_Year | Termination_Description | Call_Count

---------------+---------------------------+------------

2000 | Abnormal Call Termination | 2010

2001 | Abnormal Call Termination | 873

(2 rows)