or Logical Operator

The or logical operator indicates that only one of the components of a logical expression need be true for the expression to evaluate as true.

Syntax

exp or exp

Synonym(s)

!

Example(s)

The expression tax = 0 or value > 0 is true when either tax equals 0 and/or value is greater than 0.

if tax = 0 or value > 0 then...

The expression counter > max or value > 10 or y < 100 requires that only one or more logical expressions need be true for the complete expression to be true.

if counter > max or value > 10 or y < 100 then...

You can use the single attribute specification form of the or logical operator to optimize your queries. For example, when a numeric index on date is present, the expression:

select invoice with date = "jan 01 2013" or = "jan 02 2013"

[4041] 16461 items selected.

should run significantly faster than the multiple attribute specification form of the expression:

select invoice with date = "jan 01 2013" or with date = "jan 02 2013"

[404] 16461 items selected out of 2206402 items.

Note that in the above two examples, the message [4041] indicates that the search used an index and the message [404] indicates that no index was used.

See Also

! Logical Operator