About Conditional Expressions
Conditional expressions use the conditional operators to compare operands (typically, value expressions). When evaluated, conditional expressions yield a logical result (true or false), depending if the condition is satisfied.
|Operator||Condition Being Evaluated|
|expr = expr||The values are equal.|
|expr <> expr||The values are not equal.|
|expr < expr||The left-hand value is less than the right-hand value.|
|expr <= expr||The left-hand value is less than or equal to the right-hand value.|
|expr > expr||The left-hand value is greater than the right-hand value.|
|expr >= expr||The left-hand value is greater than or equal to the right-hand value.|
|expr between expr and expr||The value before BETWEEN is greater than or equal to the value to the right of BETWEEN and less than or equal to the value to the right of AND.|
|expr not between expr and expr||The value before NOT BETWEEN is less than the value to the right of NOT BETWEEN and greater than the value to the right of AND.|
|expr in (Â«exprÂ»)||The value before IN is a member of the list of values to the right of IN.|
|expr not in (Â«exprÂ»)||The value before NOT IN is not a member of the list of values to the right of NOT IN.|
|expr is [$]null||The value on the left is $Null.|
|expr is not [$]null||The value on the left is not $Null.|
|expr like pattern||The value before LIKE matches the pattern specified to the right of LIKE.|
|expr not like pattern||The value before NOT LIKE matches the pattern specified to the right of NOT LIKE.|
Note: The AND and BETWEEN expressions are not the Boolean AND.
Examples of Conditional Expressions
EmpNum > 1254
Logically true when EmpNum is 1254.
DepNum >= EmpNum
Logically true when DepNum is greater than or equal to EmpNum
FirstName = ‘Smith’
Logically true when FirstName is Smith.
DeptDesc <> ‘Sports’
Logically true when DeptDesc is anything but Sports.
EmpNum between 1000 and 2000
Logically true when EmpNum is in the range 1000-2000.
LastName like ‘% ith$’
Logically true when LastName matches the given pattern.
Event.EventName in (‘F1′,’F2′,’Escape’)
Logically true when EventName is in the list.
ProdCode not between 542 and 863
Logically true when ProdCode is outside the range 542-863.
LastName not in (‘Smith’,’Jones’)
Logically true when LastName is not in the list.
FirstName not like ‘ Sm%’
Logically true when Firstname fails to match the pattern.
Simple conditional expression can be combined into more complex Boolean expressions by using Boolean operators. Also, the Boolean NOT can be used to achieve the same result as the NOT version of BETWEEN, LIKE, and IN.