Database Reference
In-Depth Information
T BOOLEAN( ' True ' PERIOD( ' 2012-04-01 ' , ' 2012-07-01 ' )
' True ' PERIOD( ' 2012-10-01 ' , ' 2013-01-01 ' ))
Notice that the comparison is performed only on the time instants that are
shared by the two temporal values. Similarly, the query
SELECT AVG(E.SalaryHist)
FROM Employee E
will result in the value
T REAL( 20 PERIOD( ' 2012-01-01 ' , ' 2013-04-01 ' )
40 PERIOD( ' 2012-04-01 ' , ' 2012-10-01 ' )
60 PERIOD( ' 2012-10-01 ' , ' 2012-10-01 ' )
45 PERIOD( ' 2012-10-01 ' , ' 2013-01-01 ' )
60 PERIOD( ' 2013-01-01 ' , ' 2013-04-01 ' ))
A graphical representation of this result was shown in Fig. 12.2 .
In order to show the operations for spatial types, we will use the following
table, which keeps track of the delivery routes followed by trucks:
CREATE TABLE Delivery (
TruckId CHAR(6) PRIMARY KEY,
DeliveryDate DATE,
Route T POINT(INSTANT,TIMESTAMP) )
We insert now two tuples in this table, containing information of two
deliveries performed by two trucks T1 and T2 on the same day, January
10, 2012:
INSERT INTO Delivery VALUES ( ' T1 ' , ' 2012-01-10 ' ,
T POINT( Point(0 0) ' 08:00 ' , Point(2 2) ' 08:10 ' , Point(2 2) ' 08:25 ' ))
INSERT INTO Delivery VALUES ( ' T2 ' , ' 2012-01-10 ' ,
T POINT( Point(1 0) ' 08:05 ' , Point(3 1) ' 08:15 ' , Point(3 2) ' 08:20 ' ))
A graphical representation of the trajectories of the two trucks was shown
in Fig. 12.3 . As we are working with continuous trajectories , we assume
linear interpolation between any two consecutive points and a constant speed
between pairs of points.
We show next examples of lifted spatial operations. The following query
computes the distance of the two trucks at every instant:
SELECT ST Distance(D1.Route, D2.Route)
FROM Delivery D1, Delivery D2
WHERE D1.TruckId = T1 AND D2.TruckId = T2
This query returns
T REAL( 1 ' 08:05 ' ,1.5 ' 08:10 ' ,1.41 ' 08:25 ' ,1 ' 08:20 ' )
whose graphical representation was given in Fig. 12.4 . Similarly, the following
query computes a buffer of 0.6km and 10min around the trajectories:
 
Search WWH ::




Custom Search