A comparison operator is a class of operators that model:
A comparison operator test the order relationship between two operands and returns a Boolean.
The result of a comparison is a Boolean
Comparison Operator are tiddly coupled:
in order to sort data.
Comparison Operator are used in predicate (condition) in order to filter
order of precedence - All comparison operators have the same priority, which is lower than that of all operator mathematical operators
Comparisons may be chained.
For example, a < b == c tests whether:
Comparisons may be combined using the Boolean operators and and or to from a predicate (boolean expression)
Comparison operator models two kind of relation:
Binary relation are used in many branches of mathematics to model this relation. See Logical Data Modeling - Binary Relation.
Order relation, including strict orders:
Operation | Description |
---|---|
< | strictly less than |
<= | less than or equal |
> | strictly greater than |
>= | greater than or equal |
in | check whether a value occurs in a list |
not in | check whether a value does not occur in a list |
The equal operators model an equivalence relationship