Apply aggregate functions to expressions
The following query shows how you can apply aggregate
functions to arithmetic expressions, and declare display labels for
their results:
Figure 1. Query
SELECT MAX (res_dtime - call_dtime) maximum,
MIN (res_dtime - call_dtime) minimum,
AVG (res_dtime - call_dtime) average
FROM cust_calls;
The query finds and displays the maximum, minimum, and
average amounts of time (in days, hours, and minutes) between the
reception and resolution of a customer call, and labels the derived
values appropriately. The query result shows these aggregate time-interval
values that the query calculates:
Figure 2. Query result
maximum minimum average
5 20:55 0 00:01 1 02:56