- Time interval as an unsigned integer value.
- Type of an interval.
NANOSECONDMICROSECONDMILLISECONDSECONDMINUTEHOURDAYWEEKMONTHQUARTERYEAR
DAY interval corresponds to the IntervalDay data type:
Usage Remarks
You can useInterval-type values in arithmetical operations with Date and DateTime-type values. For example, you can add 4 days to the current time:
Aggregation
sum, avg, min, max and any over an Interval column return an interval of the same type.
sum adds up the number of units, and avg averages them and rounds the result to a whole number
of them:
Month, Quarter and Year have no common
unit with the smaller ones - a month is not a fixed number of days - and cannot be mixed with
them at all.
Mixed-type Intervals
Intervals of mixed type, e.g. multiple hours and multiple minutes, can be created usingINTERVAL 'value' <from_kind> TO <to_kind> syntax.
The result is a tuple of two or more intervals.
Supported combinations:
Non-leading fields are validated per the SQL standard:
MONTH 0-11, HOUR 0-23, MINUTE 0-59, SECOND 0-59.
+ or - sign applies to all components:
See Also
- INTERVAL operator
- toInterval type conversion functions
- avg aggregate function
- sum aggregate function