Logical Operators
- Last Updated: May 15, 2020
- 1 minute read
- DataDirect Connectors
- JDBC
- IBM Db2 5.1
- MySQL 5.1
- Progress OpenEdge 5.1
- SAP Sybase 5.1
- Documentation
A logical operator combines the results of two component conditions to produce a single result or to invert the result of a single condition. The following table lists the supported logical operators.
| Operator | Purpose | Example |
|---|---|---|
| NOT | Returns TRUE if the following condition is FALSE. Returns FALSE if it is TRUE. If it is UNKNOWN, it remains UNKNOWN. |
|
| AND | Returns TRUE if both component conditions are TRUE. Returns FALSE if either is FALSE; otherwise, returns UNKNOWN. |
|
| OR | Returns TRUE if either component condition is TRUE. Returns FALSE if both are FALSE; otherwise, returns UNKNOWN. |
|
Example
In
the Where clause of the following Select statement, the AND logical
operator is used to ensure that managers earning more than $1000
a month are returned in the result:
SELECT * FROM emp WHERE jobtitle = manager AND sal > 1000