DATEADD function page 2 |
||||||||||||||||||||||||||||||||||||
Taking the task 7.1.1 as example, let's consider addition of time interval to a date for some other DBMS MySQLMySQL has similar function with unsimilar parameters. Here is the syntax:
Where date - the date which an interval is added to; value - the interval value; addunit - the interval type. There are available the following interval types with selfdescribed names:
The solution of our task for MySQL takes the form:
To add the interval consisting of few time components, you can use the substring of standard representation of date/time. So, let's add 1 day and 3 hours to '2018-01-27T13:00:00':
Addition of 1 day and 15 seconds to the same date will be the following:
PostgreSQL and OracleThese DBMS do not use any function for addition of intervals. In this case ordinary operator "+" is used:
Take into account character data type for interval value. Addition of 1 day and 3 hours PostgreSQL PostgreSQL has not composite intervals, so we should either express interval value in the terms of lesser interval
In the same manner it could be done for addition of one day and 15 seconds, for example:
Oracle Oracle uses composite intervals, for example (one day and 3 hours):
Naturally, we could add two simple intervals as in the case of PostgreSQL.
|