AND (TSQL Operator)
Performs a logical AND of two boolean expressions.
Syntax
bool_expr AND bool_expr
Arguments
- bool_expr
- is an expression of type
bool
.
Such expression can be produced e.g. by comparison operators like=
,>
, etc.
Return Types
Returns a result of type bool
.
Remarks
In SQL, logical operators evaluate to True, False or NULL, with a 3-valued logic.
This table shows the results for the logical AND
operator.
True | False | NULL | |
---|---|---|---|
True | True | False | NULL |
False | False | False | False |
NULL | NULL | False | NULL |
Examples
PRINT 1=1 AND 2=2;
PRINT 1=1 AND 2=3;
PRINT 1=1 AND 2=NULL;
The result is:
true
false
<NULL>