-
Book Overview & Buying
-
Table Of Contents
Data Analysis Using SQL and Excel - Second Edition
By :
Determining the number of active customers as of the database cut-off date is easy, by simply counting those whose status code indicates that they are active. This section extends this simple counting mechanism to historical time periods, by progressing from counting the active customers on any given day in the past, to counting active customers on all days, and finally, to breaking customers into tenure groups and counting the sizes of those groups on any given day.
On a given day in the past, customers who are active have two characteristics:
The following query answers the question: How many subscriptions customers were active on Valentine’s Day in 2005?
SELECT COUNT(*)
FROM Subscribers
WHERE StartDate <= '2005-02-14' AND
(StopDate > '2005-02-14' OR StopDate IS NULL)
The WHERE clause implements...
Change the font size
Change margin width
Change background colour