The WEEKDAY function
The following query uses the WEEKDAY function
to indicate which day of the week calls are received and resolved
(0 represents Sunday, 1 is Monday,
and so on), and the expression columns are labeled.
Figure 1. Query
SELECT customer_num,
WEEKDAY (call_dtime) called,
WEEKDAY (res_dtime) resolved
FROM cust_calls
ORDER BY resolved;
Figure 2. Query result
customer_num called resolved
127 3
110 0 0
119 1 2
121 3 3
116 3 3
106 3 3
116 5 4
The following query uses the COUNT and WEEKDAY functions
to count how many calls were received on a weekend. This kind of statement
can give you an idea of customer-call patterns or indicate whether
overtime pay might be required.
Figure 3. Query
SELECT COUNT(*)
FROM cust_calls
WHERE WEEKDAY (call_dtime) IN (0,6);
Figure 4. Query
result
(count(*))
4