Enhancements to SQL Date/ Time Arithmetic
Original Publication Date: 1991-Dec-01
Included in the Prior Art Database: 2005-Apr-04
Publishing Venue
IBM
Related People
Boykin, JR: AUTHOR [+4]
Abstract
Structured Query Language (SQL) includes date/time data types of date, time, and timestamp. Date/time arithmetic operations are provided to manipulate values of date/time datatypes. SQL date/time arithmetic operations will be added to OS/2* Database Manager ES 1.0.
Enhancements to SQL Date/ Time Arithmetic
Structured
Query Language (SQL) includes date/time data
types of date, time, and timestamp.
Date/time arithmetic operations
are provided to manipulate values of date/time datatypes. SQL
date/time arithmetic operations will be added to OS/2* Database
Manager ES 1.0.
The family of
IBM Relational Database Products which supports
SQL Date/Time Arithmetic allows the following operations:
-
A date can be subtracted from another date, producing a date
duration.
-
A time can be subtracted from another time, producing a time
duration.
-
A date can be incremented or decremented by a date duration,
producing a date.
-
A time can be incremented or decremented by a time duration,
producing a time.
-
A timestamp can be incremented or decremented by a date or
time duration, producing a timestamp.
As an
extension to the above, the OS/2 Database Manager will
also support manipulation of timestamp values through the following
operations:
-
A timestamp can be subtracted from another timestamp,
producing a timestamp duration. This is
particularly useful for
deter mining the time elapsed
between operations when a finer
granu larity of accuracy than
seconds is imperative.
Suppose start_time and end_time
are columns of datatype
timestamp. Then the following example
illustrates the use of
timestamp subtraction:
...