Performing Date and Time Operations

DBMS compliance with SQL-92 datetime/interval operators and functions is spotty, so this section is meant to be used as a reference. DBMSes have their own extended operators and functions that perform date and time arithmetic. For information about datetime and interval data types, see “Datetime Types” and “Interval Types” in Chapter 3.

Use the same operators introduced in “Performing Arithmetic Operations” earlier in this chapter to perform datetime and interval arithmetic. The common temporal operations are:

  • Subtracting two dates to calculate the interval between them

  • Adding or subtracting an interval and ...

Get SQL: Visual QuickStart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.