DaveBirdsall commented on a change in pull request #1799: [TRAFODION-3277] Add *OVERLAPS predicate* in Trafodion SQL Reference Manual URL: https://github.com/apache/trafodion/pull/1799#discussion_r258287711
########## File path: docs/sql_reference/src/asciidoc/_chapters/sql_language_elements.adoc ########## @@ -3694,6 +3694,393 @@ evaluates to null: (first_name, salary) IS NULL ``` +<<< +[[overlaps_predicate]] +=== OVERLAPS Predicate + +The OVERLAPS predicate evaluates whether two date-time periods overlap each other. The date-time period is a pair of date-time expressions. + +``` +(start 1, end 1) OVERLAPS (start 2, end 2) +``` + +[[syntax_description_of_overlaps]] +==== Syntax Description of OVERLAPS + +* `_start 1, start 2_` + ++ +Specifies the beginning of a date-time period, which can be a DATE, TIME or TIMESTAMP value. + ++ +NOTE: `_start 1, start 2_` cannot be NULL. + + +* `_end 1, end 2_` ++ +Specifies the end of a date-time period, which can be a DATE, TIME, TIMESTAMP or INTERVAL value. + ++ +NOTE: `_end 1, end 2_` cannot be NULL. + ++ +The INTERVAL value advances or decrements date-time period. + ++ +*Example* + ++ +These two date-time periods overlap since TIMESTAMP '2019-11-02 01:00:00' is less than one hour before TIMESTAMP '2019-11-02 02:00:01'. + ++ +``` +SELECT 'Technical Writer' FROM DUAL +WHERE +(TIMESTAMP '2019-11-02 02:00:01', INTERVAL -'1' HOUR) +OVERLAPS +(TIMESTAMP '2019-11-02 01:00:00', INTERVAL '2' HOUR); + +(EXPR) +---------------- +Technical Writer + +--- 1 row(s) selected. +``` + +[[considerations_for_overlaps]] +==== Considerations for OVERLAPS + +* If two date-time periods are not instantaneous, they overlap when they share a common period, that is, they must have one-second overlap for TIME/TIMESTAMP or one-day overlap for DATE/TIMESTAMP. + ++ +TIP: S1-E1 stands for `_(start 1, end 1)_`, S2-E2 stands for `_(start 2, end 2)_`, and so forth. Review comment: Perhaps a little more explanation is called for here. Maybe: "The diagram below describes how various time periods overlap the time period S1-E1. Here, Sn-En refers to `_(start n, end n)_`. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
