The traditional comparison operators (=
, <
, and so on) can be applied to box types. Excepted equality and inequality, the other comparison operators are not useful in the real world but allow B-tree indexes to be constructed on box types. These operators compare first the timestamps and if those are equal, compare the values.
Are the bounding boxes equal?
box = box → boolean
SELECT tbox 'TBOXINT XT([1,1],[2001-01-01,2001-01-04])' = tbox 'TBOXINT XT([2,2],[2001-01-03,2001-01-05])'; -- false
Are the bounding boxes different?
box <> box → boolean
SELECT tbox 'TBOXFLOAT XT([1,1],[2001-01-01,2001-01-04])' <> tbox 'TBOXFLOAT XT([2,2],[2001-01-03,2001-01-05])'; -- true
Is the first bounding box less than the second one?
box < box → boolean
SELECT tbox 'TBOXINT XT([1,1],[2001-01-01,2001-01-04])' < tbox 'TBOXINT XT([1,2],[2001-01-03,2001-01-05])'; -- true
Is the first bounding box greater than the second one?
box > box → boolean
SELECT tbox 'TBOXFLOAT XT([1,1],[2001-01-03,2001-01-04])' > tbox 'TBOXFLOAT XT((1,2),[2001-01-01,2001-01-05])'; -- true
Is the first bounding box less than or equal to the second one?
box <= box → boolean
SELECT tbox 'TBOXINT XT([1,1],[2001-01-01,2001-01-04])' <= tbox 'TBOXINT XT([2,2],[2001-01-03,2001-01-05])'; -- true
Is the first bounding box greater than or equal to the second one?
box >= box → boolean
SELECT tbox 'TBOXFLOAT XT([1,1],[2001-01-01,2001-01-04])' >= tbox 'TBOXFLOAT XT([2,2],[2001-01-03,2001-01-05])'; -- false