comparison operator

An operator that compares two values and gives true or false, such as equal, not equal, less than or greater than.

In more detail

Many programming languages write equal as == and not equal as !=, while SQL uses a single = and the standard not-equal spelling <>. In languages where a single = assigns, mixing it up with == is a classic bug. Comparing decimal fractions for exact equality is unreliable because of rounding, and in SQL any comparison with null gives unknown rather than true.

Examples

3 == 3.0   # True
WHERE status <> 'paid'

Related terms

Taught in

References

Certification courses