Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Wed, 31 Oct 2012 @ 14:43:27 GMT

  <Prev Next>   <<First <Prev Next> Last>>  

Subj:   Re: OVERLAPS question
From:   Geoffrey Rommel

And why is that expression so complex?

     [a]   (S1 > S2 AND NOT (S1 >= E2 AND E1 >= E2))
     [b]   (S2 > S1 AND NOT (S2 >= E1 AND E2 >= E1))
     [c]   (S1 = S2 AND (E1 = E2 OR E1 <> E2))

The NOT in [a] is confusing, so let's simplify it:

     (S1 > S2 AND (S1 < E2 OR E1 < E2))

Now, if S1 > S2, the only way the periods can overlap is if E2 > S1. I'm pretty sure that the test for E1 < E2 is redundant. Thus, this can be simplified to:

     (S1 > S2 AND S1 < E2)

Likewise, [b] can be simplified to:

     (S2 > S1 AND S2 < E1)

[c] is particularly odd -- E1 is equal to E2 or not equal to E2? Simplify to:

     (S1 = S2)

Thus the whole expression reduces to:

     (S2 < S1 AND S1 < E2)
     (S1 < S2 AND S2 < E1)
     (S1 = S2)

I am currently working on test cases in order to prove this hypothesis. I've already found three cases in which the expression in the manual does not return the same result as the OVERLAPS predicate.

  <Prev Next>   <<First <Prev Next> Last>>  
  Top Home Privacy Feedback  
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 28 Jun 2020