----------  WHERE Clause  ----------

A WHERE clause is used to specify a condition which a record must  satisfy  in
order  to  be  selected.  It consists of boolean expressions, that is, expres-
sions that evaluate to "true" or "false".

A WHERE clause may be built up using boolean expressions that are joined using
"and" and "or".

Syntax:

     where |B_EXPR           |
           |(B_EXPR)         |
           |B_EXPR or B_EXPR |
           |B_EXPR and B_EXPR|
           |not B_EXPR       |

If two boolean expressions are joined by an "and",  both  boolean  expressions
must be true in order for the whole boolean expression to be true.

If two boolean expressions are joined by an "or", either one or  both  boolean
expressions must be true in order for the whole boolean expression to be true.

The "and" operator has precedence over the "or" operator.

A WHERE clause may have boolean expressions of the form:

     | EXPR [ |is      | ] CONDITION |
     |        |[is] not|             |
     |                               |
     | null EXPR                     |
     |                               |
     | exists SUBQUERY               |

A CONDITION is:

     | | =  | | EXPR     |                                             |
     | | != | | SUBQUERY |                                             |
     | | >  |                                                          |
     | | >= |                                                          |
     | | <  |                                                          |
     | | <= |                                                          |
     |                                                                 |
     | in (EXPR {, EXPR})                                              |
     | in SUBQUERY                                                     |
     |                                                                 |
     | like LIKE_PATTERN [ESCAPE_ATOM]                                 |
     |                                                                 |
     | | match   | PATTERN                                             |
     | | !match  |                                                     |
     | | smatch  |                                                     |
     | | !smatch |                                                     |
     |                                                                 |
     | [ | =  | ] null                                                 |
     |   | != |                                                        |
     |                                                                 |
     | between |EXPR    | [|exclusive|] [and] |EXPR    | [|exclusive|] |
     |         |SUBQUERY|  |inclusive|        |SUBQUERY|  |inclusive|  |
     |                                                                 |
     | range |EXPR    | [|exclusive|] [to] |EXPR    | [|exclusive|]    |
     |       |SUBQUERY|  |inclusive|       |SUBQUERY|  |inclusive|     |

Refer to the "select" command for information on SUBQUERY.

"Between ... and" is an alternative to "range ... to".  Values  are  inclusive
by  default and must be in increasing order for any records to meet the condi-
tion.

Pattern Matching in WHERE clauses:

     like:               dual-case pattern match
     match, !match:      dual-case enhanced pattern match or not-match
     smatch, !smatch:    single-case enhanced pattern match or not-match

     "like" is the ANSI SQL pattern-matching operator.
     "match" and "smatch" are enhanced pattern-matching operators.

     LIKE_PATTERN may be a whole attribute value or a part value plus the fol-
     lowing special characters:

             '_'  stands for any single character
             '%'  stands for zero or more of any character

         ESCAPE_ATOM is a single character that, when preceding the characters
         '_' and '%', forces Empress to interpret them literally instead
         of as special characters.

     PATTERN may be a whole attribute value, or a part value plus the  follow-
     ing special characters:

             '*'  stands for zero or more of any character
             '?'  stands for any single character
             '|'  joins two patterns, either may match to select
             '&'  joins two patterns, both must match to select
             '\' causes the next single character to be taken literally
                  even if it is a special character

     A set of characters at a given position may be matched by  enclosing  the
     characters in square brackets:

             [abc] matches "a" or "b" or "c" at that position

     Ranges in classes are indicated by a "-":

             [a-cf-i] matches a, b, c, f, g, h, i

     Not-classes are indicated by a "^":

             [^123] matches anything except 1, 2, or 3
             [^a-c] matches anything except a, b, or c

     An string of arbitrary length composed of any of a set of characters  may
     be matched by enclosing the characters in brace brackets:

             {abc} matches "a", "aa", "ab", "cacccbaa" and so on
             {[a-z]} matches any string composed of lower-case letters

For further information, enter:

        help delete;
        help expr;
        help select;
        help update;
