Using Relational Operators

Relational operators may be used in selection expressions to compare data to a constant or to the data in another attribute. If the data is left-justified, as defined by line 9 of the Attribute Definition item, the data is compared from left to right. Any characters that are not identical are converted to their numeric ASCII equivalents and compared. Higher ASCII equivalents are considered greater (>).

If the data is right-justified, first a numeric comparison is made. Nonnumeric characters are then converted to their numeric ASCII equivalents and compared.

This query selects customers whose zip code is a number less than 21300:

>LIST CUSTOMERS WITH ZIP < "21300"

Relational operators may be used with both alphabetic and numeric characters. For example, the next query selects customers whose last names alphabetically precede Mansfield:

>LIST CUSTOMERS WITH LAST-NAME < "MANSFIELD"

If no relational operator is explicitly specified, Equal To is assumed. For example:

>LIST CUSTOMERS WITH CITY "BALTIMORE"

If no attribute is specified, the item-ID is assumed. In this case, the user may omit the WITH connective. For example:

>LIST ORDERS < "10183"

The preceding query lists all orders whose item-IDs are less than 10183.

The table below lists the relational operators that may be used in INFO/ACCESS queries. Note that there are at least two ways to specify each operator.

Operator

Function

= or EQ

Equal to.

> or GT or AFTER

Greater than.

< or LT or BEFORE

Less than.

>= or GE

Greater than or equal to.

<= or LE

Less than or equal to.

# or NE or NO [T]

Not equal to or null.

See Also

Using Selection Expressions

String Searching

Using the LIKE Connective

Using Logical Connectives

Selection Options