2. SQL Data Types : Data Types : Interval Data Types
 
Share this page                  
Interval Data Types
The INTERVAL data types include year to month and day to second intervals.
The format is as follows:
INTERVAL interval_qualifier
interval_qualifier
Defines an interval column as one of the following:
YEAR TO MONTH
DAY TO SECOND [(second_precision)]
where second_precision is the number of digits in the fractions of seconds field.
Note:  When a value is entered that exceeds the specified precision, the value is truncated at the specified precision.
Examples:
Interval Format
Example
Explanation
INTERVAL YEAR TO MONTH
123-04
An interval of 123 years, 4 months
INTERVAL DAY TO SECOND(3)
7 6:54:32.123
An interval of 7 days, 6 hours, 54 minutes, 32 seconds and 123 thousandths of a second