Relations of comparison are the simplest relations. They can be specified for every field type. The simple condition containing relations of comparison should have one operand.
Possible comparison relations in ObjectLand are presented in table 26-2. In the column “symbol” a sign denoting the relation used when specifying the search condition is given, in the column “name” – the relation name, and in the column “requirement for true simple condition” – description of the correlation between field values and operands in which simple condition will be true.
symbol | name | requirement for true simple condition |
= | equal | The field value is equal to the operand value |
~= | not equal | The field value is not equal to the operand value |
< | less | The field value is less than the operand value |
<= | not greater | The field value is not greater than the operand value |
> | greater | The field value is greater than the operand value |
>= | not less | The field value is not less than the operand value |
Table 26-2. Comparison relations
Relations of comparison for numeric (integer and real) fields are evident. Let us clarify the method of comparison of string, date, time and Boolean values.
Comparison of strings is founded on comparison of separate characters.
The order of characters is determined by the settings of the operating system. As a rule, any digit is less than a letter, Latin letters are less than Cyrillic, upper-case letters are less than lower-case letters, Latin and Cyrillic letters are sorted in alphabetical order, the space character is less than any other character.
When comparing strings, at the beginning the first characters of strings are compared, if they are equal, the second characters are compared and so on until different characters appear. The strings are considered to be equal if they contain the same number of characters, and characters occupying the same positions coincide.
If the length of the strings is different, before performing comparison the shortest string is padded with spaces.
For example:
the string “Hi” is less then the string “hi” because the capital letter “H” is less than the small letter “h”;
the string “Jack” is less than the string “Jane” because the first two letters of the strings are equal and the third ones differ and the letter “c” is less than the letter “n”;
the string “Hallo” is less than the string “Halloween”: before comparing the first shorter string will be padded with spaces, the letters from first to fifth will coincide and the difference will be in the sixth character which is a “space” for the first string and the letter “w” for the second;
the string “Halloween” is less than the string “hallow” because these strings differ in first characters already, and the capital letter “H” is less than the small letter “h”.
When comparing dates an earlier date is considered to be less than the later one. That is, the expression:
03/02/1994 > 05/28/1993 – is true,
and the expression:
05/28/1890 > 03/02/1900 – is false.
By analogy, an earlier time of the day is considered to be less than the later one.
For the type “Timestamp” comparison is made first for dates and only when the dates are equal – for time. For example, the expression
11/07/2000 10:33:44 PM > 11/07/2000 11:55:00 AM – is true,
and the expression:
05/28/1890 10:00:00 PM > 03/02/1900 10:00:00 AM – is false.
Boolean data is ordered by the following rule: False < True.