SQL - Interval

Data System Architecture

About

time duration is known as interval in SQL.

Syntax

An SQL interval data type descriptor contains:

  • the name of the interval data type (INTERVAL);
  • an indication of whether the interval data type is :
    • a year-month interval. It can include only YEAR, MONTH field and not both field are required.
    • or a day-time interval. It can include any fields other than YEAR or MONTH.
  • the <interval qualifier> that describes the precision of the interval data type.

Operations

Datetime  -  Datetime  = Interval
Datetime  + or -  Interval  = Datetime
Interval + Datetime = Datetime
Interval + or - Interval = Interval
Interval * or / Numeric = Interval
Numeric * Interval = Interval





Discover More
Data System Architecture
SQL - Data Type

The Data Type of a column in SQL. They are defined in the ANSI/ISO SQL standard but may vary from sql engine (database) to another. The below table shows you the history of the data type in the ANSI...



Share this page:
Follow us:
Task Runner