Logical operators combine or manipulate conditions in a SQL query.
| Operator | Meaning | |
|---|
AND | Returns true if both operands are true. Otherwise, returns false. | |
BETWEEN | Returns true if the left operand is within the range of the right operand. | |
EXISTS | Returns true if the results of a subquery are not empty. | |
IN | Returns true if the left operand is in the right operand list. | |
LIKE | Returns true if the left operand matches the right operand pattern string. | |
NOT | Negates the subsequent expression. | |
OR | Returns true if any operand is true. Otherwise, returns false. | |
Sample data
Query examples on this page use the following sample data sets:
AND
The AND operand returns true if both operands are true. Otherwise, it returns false.
This operator is typically used in the WHERE clause
to combine multiple conditions.
SELECT true AND false AS "AND condition"
Examples
AND operator in the WHERE clause
SELECT *
FROM home
WHERE
co > 10
AND room = 'Kitchen'