Previous
Topic:
Interval Arithmetic |
Next
Topic: Interval Comparisons |
Interval Aggregation
Intervals of the same type can be grouped together using a subset of the aggregation functions. When intervals are aggregated in this manner, the resulting value is the same interval type.
The following aggregate functions can be used to group interval values:
- MIN
- MAX
- AVG
- SUM
Examplegiven SMALLINT column c1:
c1 10 90 55 33 48 MIN (C1 * 10 DAYS) = 100 (days)
MAX (C1 - 5 SECONDS) = 85 (seconds)
AVG (C1 + 10 HOURS) = 36047 (seconds)
SUM (C1 - 1 MINUTE) = -64 (seconds)