O'Reilly logo

SQL: Visual QuickStart Guide by Chris Fehily

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Interval Types

DBMS compliance with SQL-92 intervals is spotty, so this section is meant to be used as a reference. DBMSes have their own extended data types and functions that calculate intervals and perform date and time arithmetic.

Use interval data types to represent intervals between dates and times of day. An interval value has these characteristics:

  • It stores the quantity of time between two datetime values. Between 09:00 and 13:30 is an interval of 04:30 (4 hours and 30 minutes), for example. If you subtract two datetime values, you get an interval.

  • It can be used to increment or decrement a datetime value; see “"Performing Date and Time ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required