Comparison Predicate (SQL)

Help Contents


The SQL Comparison Predicate compares two values returning TRUE, FALSE, or UNKNOWN.


comparison-predicate ::=
  test-expression comparison-predicate-part2

comparison-predicate-part2 ::=
  comp-op value-expression

comp-op ::=
  = | <> | > | >= | < | <=

Syntax Details

test-expression is the Value Expression being tested.

comp-op is the comparison operation.

The comparison-predicate-part2 can be used as a test in the when-operand of a Case Function.


The comparison predicate compares the two values using the designated operator. If either value is NULL, the comparison predicate returns UNKNOWN.

To test for NULL use the Is Null Predicate, rather than the comparison X = NULL. The comparison X = NULL will always return UNKNOWN, which by definition is not TRUE.


To find all digital tags with bad quality:

Select FullName
From TagDataPointDigital
Where Quality < 192

Note: The value 192 is the threshold for good quality.

Further Information


To learn about other types of predicate.

Fernhill SCADA Structured Query Language (SQL)

To learn more about the SQL features in Fernhill SCADA.


For the meaning of terms used in Fernhill SCADA.