The SQL **Search Condition** specifies a condition that results in **FALSE**, **TRUE**, or **UNKNOWN**.

search-condition ::=

boolean-value-expression

boolean-value-expression ::=

boolean-term

| boolean-value-expression OR boolean-term

boolean-term ::=

boolean-factor

| boolean-term AND boolean-factor

boolean-factor ::=

[ NOT ] boolean-test

boolean-test ::=

boolean-primary [ IS [ NOT ] truth-value ]

truth-value ::=

TRUE | FALSE | UNKNOWN

boolean-primary ::=

predicate

| nonparenthesized-value-primary

| ( boolean-value-expression )

In SQL, boolean expressions use 3-state logic, which can result in one of three values: **FALSE**, **TRUE**, or **UNKNOWN**.
**UNKNOWN** is typically returned when one or more values are NULL.

The truth table of the AND operator:

AND | True | False | Unknown |
---|---|---|---|

True | True | False | Unknown |

False | False | False | False |

Unknown | Unknown | False | Unknown |

The truth table of the OR operator:

OR | True | False | Unknown |
---|---|---|---|

True | True | True | True |

False | True | False | Unknown |

Unknown | True | Unknown | Unknown |

The truth table of the IS operator:

IS | True | False | Unknown |
---|---|---|---|

True | True | False | False |

False | False | True | False |

Unknown | False | False | True |

To find all analog voltage tags that are less than 23.5 volts:

Select FullName,Value

From TagDataPointAnalog

Where Units = 'Volts' AND Value < 23.5

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**.