Binary comparison operators
Use binary comparison operators to compare numeric and string values for equality and inequality.
The following table describes the comparison operators supported by the ObjectServer.
Operator | Description | Example |
---|---|---|
= | Tests for equality. | SELECT * FROM london.status WHERE Severity = 3; |
!= <> |
Tests for inequality. | SELECT * FROM london.status WHERE Severity <>
1; |
< > <= >= |
Tests for greater than (>), less than (<), greater than
or equal to (>=) or less than or equal to (<=). These operators perform case-sensitive string comparisons. In standard ASCII case-sensitive comparisons, uppercase letters come before lowercase letters. |
SELECT * FROM london.status WHERE Severity > 5; |
%= %!= %<> |
Tests for equality (%=) or inequality (%!=, %<>) between strings, ignoring case. To be equal, the strings must contain all of the same characters, in the same order, but they do not need to have the same capitalization. | SELECT * FROM london.status WHERE Location %= 'New
York'; |
%< %> %<= %>= |
Compares the lexicographic relationship between two strings,
ignoring case. This comparison determines whether strings come before
(%<) or after (%>) other strings alphabetically. You can also
find strings that are less than or equal to (%<=) or greater than
or equal to (%>=) other strings. For example, |
SELECT * FROM london.status WHERE site_code %< 'UK3'; |
[NOT] LIKE | The LIKE operator performs string comparisons. The string following
the LIKE operator, which can be the result of a regular expression,
is the pattern to which the column expression is compared. The NOT keyword inverts the result of the comparison. |
SELECT * FROM london.status WHERE Summary LIKE 'down'; The
result is all rows in which |
The LIKE and NOT LIKE comparison operators allow regular expression
pattern-matching in the string being compared to the column expression.
Regular expressions are sequences of atoms that are made
up of normal characters and metacharacters. An atom is a single character
or a pattern of one or more characters in parentheses. Normal characters
include uppercase and lowercase letters, and numbers. Metacharacters
are non-alphabetic characters that possess special meanings in regular
expressions. The ObjectServer supports two types of regular expression
libraries:
- NETCOOL: Use this default library for single-byte character processing.
- TRE: This library enables usage of the POSIX 1003.2 extended regular expression syntax, and provides support for both single-byte and multi-byte character languages.