Comparison operators |
For all data types, comparison operators include:
=
equal
<
less than
>
greater than
<=
less than or equal
>=
greater than or equal
<>
not equal (less than or greater than)
NOT
NOT, used with another operator, reverses the meaning of the other operator. For instance, NOT> means not greater than, which is the same as less than or equal to.
LIKE
For comparisons of strings, comparison operators also include the LIKE operator. LIKE compares two strings and treats the comparison as true if all of the characters in the shorter string match the initial characters in the longer string. LIKE ignores any additional characters in the longer string. Thus,
‘ABCDEFGH’ LIKE ‘ABC%’ is true
‘ABCDEFGH’ LIKE ‘ABCDE%’ is true
‘ABCDEFGH’ LIKE ‘ABD%’ is not true
‘ABC’ LIKE ‘ABC’ is true
‘ABC’ LIKE ‘ABD’ is not true
‘ABC’ LIKE ‘ABCD’ is not true