A data type representing a span of time (e.g., '3 days', '2 hours 30 minutes') that can be stored, compared, and used in date arithmetic.
Stores a duration of time (days, months, years, hours, minutes, seconds). Useful for date arithmetic: current_date plus interval 7 days. Precision and unit handling vary -- verify behavior with your database interval arithmetic.
| Database System | Support Status | Since Version | Notes |
|---|---|---|---|
| MySQL | ✓ Supported | 5.0 | INTERVAL is a keyword used in date arithmetic expressions but is not a storable column type. Store durations as INT (seconds) or separate numeric columns. |
| PostgreSQL | ✓ Supported | 7.4 | INTERVAL is a fully storable column type. Supports ISO 8601 and verbose input formats. Arithmetic with timestamp/date produces and consumes INTERVAL values natively. |
| SQL Server | ✗ Not Supported | — | No INTERVAL type or keyword. Date arithmetic uses DATEADD() and DATEDIFF() functions. Durations must be stored as numeric columns. |
| Oracle | ✓ Supported | 9i | Two storable interval types: INTERVAL YEAR TO MONTH and INTERVAL DAY TO SECOND. They are not interchangeable and cannot be mixed in arithmetic. |
| SQLite | ✗ Not Supported | — | No INTERVAL type. Date arithmetic uses the date()/datetime() functions with modifier strings like '+7 days'. Store intervals as integer seconds or text. |
PostgreSQL has the most complete INTERVAL implementation — it is a first-class storable type with rich literal syntax and seamless arithmetic with timestamps. Oracle's two-type split (YEAR TO MONTH vs DAY TO SECOND) reflects the genuine semantic problem that a month is not a fixed number of days; the two types cannot be mixed in arithmetic. MySQL uses INTERVAL only as an arithmetic keyword, not a storable type — a frequently missed distinction. SQL Server and SQLite have no interval concept at all; developers store durations as integers and compute with DATEADD/DATEDIFF or SQLite's string modifier functions. The lack of a storable interval type in three of five engines makes this a portability challenge for applications that need to persist duration values such as SLAs, scheduling windows, or rate limit windows.
INTERVAL is a keyword used in date arithmetic expressions but is not a storable column type. Store durations as INT (seconds) or separate numeric columns.
INTERVAL is a fully storable column type. Supports ISO 8601 and verbose input formats. Arithmetic with timestamp/date produces and consumes INTERVAL values natively.
No INTERVAL type or keyword. Date arithmetic uses DATEADD() and DATEDIFF() functions. Durations must be stored as numeric columns.
Two storable interval types: INTERVAL YEAR TO MONTH and INTERVAL DAY TO SECOND. They are not interchangeable and cannot be mixed in arithmetic.
No INTERVAL type. Date arithmetic uses the date()/datetime() functions with modifier strings like '+7 days'. Store intervals as integer seconds or text.