BETWEEN Operator

The BETWEEN operator allows the XDB Server to evaluate whether or not data values sort between a range of values indicated in the predicate.

The format for a predicate with a BETWEEN operator is shown below:

expres1 [NOT] BETWEEN expres2 AND expres3

Each occurrence of the expression expres1 is evaluated to determine if it sorts between and including the range values indicated by expres2 and expres3 (the range values in the BETWEEN clause are also part of the result set). The three variable expressions above can consist of any combination of column data values, constants, etc.

The next query selects all PART table records with WEIGHT column values between 15 and 18:

SELECT pno, pname
  FROM part
  WHERE weight BETWEEN 15 AND 18

The following records are retrieved:

pno pname
P2 BOLT