Logical Operators (Transact-SQL)

 

Logical operators test for the truth of some condition. Logical operators, like comparison operators, return a Boolean data type with a value of TRUE, FALSE, or UNKNOWN.

OperatorMeaning
ALLTRUE if all of a set of comparisons are TRUE.
ANDTRUE if both Boolean expressions are TRUE.
ANYTRUE if any one of a set of comparisons are TRUE.
BETWEENTRUE if the operand is within a range.
EXISTSTRUE if a subquery contains any rows.
INTRUE if the operand is equal to one of a list of expressions.
LIKETRUE if the operand matches a pattern.
NOTReverses the value of any other Boolean operator.
ORTRUE if either Boolean expression is TRUE.
SOMETRUE if some of a set of comparisons are TRUE.

Operator Precedence (Transact-SQL)

Community Additions

ADD
Show: