Interval Qualifier
Specifies how to interpret and format an interval literal for output, and, optionally, sets precision. Interval qualifiers are composed of one or two units:
unit[p] [ TO unit[p] ]
where:
- unit specifies a day-time or year-month subtype.
- p specifies precision, an integer between 0 and 6. In general, precision only applies to
SECOND
units. The default precision forSECOND
is 6. For details, see Specifying Interval Precision.
If an interval omits an interval qualifier, the default is DAY TO SECOND(6)
.
Interval qualifiers are divided into two categories: day-time and year-month, as shown in the tables below.
YEAR
|
Unconstrained |
MONTH
|
Months within year |
YEAR TO MONTH
|
Span of years and months |
Note: Vertica also supports INTERVALYM
, which is an alias for INTERVAL YEAR TO MONTH
. Thus, the following two statements are equivalent:
=> SELECT INTERVALYM '1 2'; ?column? ------------ 1 year 2 months => SELECT INTERVAL '1 2' YEAR TO MONTH; ?column? ----------------- 1 year 2 months (1 row)