INTERVAL
Measures the difference between two points in time. Intervals can be positive or negative. The INTERVAL
data type is divided into two major subtypes:
- Year-month: Span of years and months
- Day-time: Span of days, hours, minutes, seconds, and fractional seconds
Syntax
INTERVAL [ (p) ] 'interval‑literal' [ interval‑qualifier ]
Parameters
p |
Specifies precision of the seconds field, where p is an integer between 0 - 6. For details, see Specifying Interval Precision. Default: 6 |
interval‑literal |
A character string that expresses an interval, conforms to this format: [-] { quantity subtype-unit }[...] [ AGO ] For details, see Interval Literal. |
interval‑qualifier |
Optionally specifies how to interpret and format an interval literal for output, and, optionally, sets precision. If omitted, the default is |
Limits
Name | Low Value | High Value | Resolution |
---|---|---|---|
INTERVAL [(p)] DAY TO SECOND
|
|
|
1 microsecond |
INTERVAL [(p)] YEAR TO MONTH
|
|
|
1 month |