How do oracle date time work? I have following where condition in query. What the time is between T1 and T2 means it includes or excludes the boundary. Also between T1 and T1 means what?I am confused as both returns result.

DATETIME BETWEEN TO_DATE(D1-T1,'MM-dd-yyyy HH24:MI:SS' )  AND TO_DATE(D1-T2,'MM-dd-yyyy HH24:MI:SS' )

DATETIME BETWEEN TO_DATE(D1-T1,'MM-dd-yyyy HH24:MI:SS' )  AND TO_DATE(D1-T1,'MM-dd-yyyy HH24:MI:SS' )
BETWEEN is inclusive. From the documentation:


  And the value of

expr1 BETWEEN expr2 AND expr3

  
  is the value of the boolean expression:

expr2 &lt;= expr1 AND expr1 &lt;= expr3



So your first clause will match exactly T1, exactly T2, and anything in between. Your second clause will match exactly T1, i.e. any rows where DATETIME is exactly T1.