613-518-1166 info@zimdatabases.com
Select Page

# How To Use Logic Expressions

A logic expression is an expression that, when evaluated, yields either a \$True or a \$False result.

Logic expressions are subdivided into conditional expressions and Boolean expressions.

## How To Construct Conditional Expressions

A conditional expression is a complex logic expression that consists of two value expressions and an associated conditional operator. The conditional operator performs a designated comparison of the value expressions and returns the result \$True or \$False. Conditional expressions can be combined into Boolean expressions.

The conditional operators are

= (equals)

<> (not equals)

< (less than)

> (greater than)

<= (less than or equals)

>= (greater than or equals)

[NOT] BETWEEN

[NOT] IN

[NOT] LIKE

Examples of Conditional Expressions

EmpNum < 1254

DeptNum >= EmpNum

First Name = “Smith”

DeptDesc <> “Sports”

EmpNum between 1000 and 2000

LastName like “%ith%”

Event.EventName in (“F1”, “F2”, “Escape”)

ProdCode not between 542 and 863

LastName not in (“Smith”, “Jones”)

FirstName not like “Sm%”

## How To Use Boolean Expressions

A Boolean expression is a complex logic expression that consists of one or more conditional expressions and an associated Boolean operator. The Boolean operator performs a Boolean operation on the \$True or \$False values returned by the conditional expression(s) and returns the result \$True or \$False.

The Boolean operators are

AND

OR

XOR

NOT

Examples of Boolean Expressions

LastName = “Allan” or FirstName = “Allan”

DeptNum = “Sports” and Salary > 45000 and LastName = “Smith”

not Salary > 45000

\$and

\$not

\$or

Truth Tables