Showing posts with label TEMPORAL QUERYING CONSTRUCTS. Show all posts
Showing posts with label TEMPORAL QUERYING CONSTRUCTS. Show all posts

Friday, January 31, 2014

TEMPORAL QUERYING CONSTRUCTS AND THE TSQL2 LANGUAGE


The TSQL2 language, extends SQL for querying valid time, transaction time, and bitemporal relational databases.
 TEMPORAL  DATABASES
In a temporal database, the conditions may involve time in addition to attributes.
A pure time condition involves only time
PURE TIME CONDITIONS:
  Suppose a user wants to select all employee versions that were valid at any point during 1997.
                 SELECT NAME
                 FROM   EMPLOYEE
                 WHERE   [t.VST, t.VET] OVERLAPS [1997-01-01, 1997-12-31

ATTRIBUTE AND TIME CONDITION
Suppose we wish to retrieve all EMP_VT tuple versions t for
employees who worked in department 5 at any time during 1997.

 SELECT  *  FROM  EMPLOYEE WHERE
 ([t.VST, t.VET] OVERLAPS [1997-01-01, 1997-12-31]) AND (t.DNO = 5)

3.3   Common operations used in queries
[t.VST, t.VET] INCLUDES [t1, t2]              Equivalent to  (t1>= t.VST AND t2<= 1 t.VET )
[t.VST, t.VET] INCLUDED_IN [t1, t2]      Equivalent to (t1 <=1 t.VST AND t2>= t.VET)
[t.VST, t.VET] OVERLAPS [t1, t2]                         Equivalent to (t1 1<= t.VET AND t2>= t.VST) 
[t.VST, t.VET] BEFORE [t1, t2]                   Equivalent to   (t1 >=t.VET)
[t.VST, t.VET] AFTER [t1, t2]                     Equivalent to   (t2<= t . VST)            
[t.VST, t.VET] MEETS_BEFORE [t1, t2]      Equivalent to   (t1 = t.VET + 1 )   
[t.VST, t.VET] MEETS_AFTER [t1, t2]      Equivalent to   (t2 + 1 = t.VST )
           
For any two time periods [t1, t2] and [t3, t4] in a temporal element, the
following three conditions must hold:
            • [t1, t2] intersection [t3, t4] is empty.
            • t3 is not the time point following t2 in the given granularity.
            • t1 is not the time point following t4 in the given granularity.