# Ordinal Data - Comparison Operator (Order, Equality)

### Table of Contents

## 1 - About

A comparison operator is a class of operators that model:

- a order
- or a equivalence relationship

A comparison operator test the order relationship between two operands and returns a Boolean.

The result of a comparison is a Boolean

## 2 - Articles Related

## 3 - Usage

### 3.1 - Sort

### 3.2 - Condition / Filter

Comparison Operator are used in predicate (condition) in order to filter

## 4 - Properties

### 4.1 - Order of precedence

order of precedence - All comparison operators have the same priority, which is lower than that of all operator mathematical operators

### 4.2 - Chain

Comparisons may be chained.

For example, a < b == c tests whether:

- a < b
- and moreover b == c

### 4.3 - Combination

Comparisons may be combined using the Boolean operators and and or to from a predicate (boolean expression)

## 5 - Relation

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.

### 5.1 - Order

Order relation, including strict orders:

- greater than or equal to
- less than or equal to
- divides (evenly)
- is a subset of

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 |

### 5.2 - Equivalence

The equal operators model an equivalence relationship