DMA Well Known Query Operators
Ordering Rules
For all the ordering relational operators (greater, greater or equal, less, less or equal), for all datatypes, the null value collates before any non null value.
Two strings of unequal length are always unequal. If two strings are of unequal length, and the initial prefix of the longer string is equal to the entire shorter string, then the shorter string collates before the longer string. The collating sequence used in the comparison for all the string relational operators is specified by a property on the Query Object. Refer to the discussion on the query object.
The comparison of binary operands is done one unsigned byte at a time from lower index values to higher index values. Two binary operands of unequal length are always unequal. If the two binary operands are of unequal length, and the initial prefix of the longer operand is equal to the entire shorter operand, then the shorter operand collates before the longer operand.
The comparison of lists is done one element at a time, starting from element zero. The first corresponding pair of list elements with unequal values determines the outcome of the compare. If no corresponding pair of list elements have unequal values, the lists are considered equal. Two lists of unequal lengths are always unequal. If two lists are of unequal length, and the initial elements of the longer list are equal to the corresponding elements in the shorter list, then the shorter list collates before the longer list.
Note: The above rules are in harmony with the ANSI/ISO SQL 92 standards: ANSI X3.135-1992, "Database Language SQL", and ISO/IEC 9075:1992, "Database Language SQL".
When a singleton is compared against a list, the singleton is treated as if it were a list of one element, and the comparison proceeds as for two lists.