Logical and Bitwise Operators
Logical NOT (!)
Function: Performs a logical NOT operation on an expression, i.e., if the expression is true, returns false; if the expression is false, returns true.
Parameters:
expr
: Boolean expression.
Return Result:
- Boolean value.
Example:
Bitwise NOT (~)
Function: Performs a bitwise NOT operation on the expression, which means turning every 0 into 1 and every 1 into 0.
Parameters:
expr
: An integer type expression.
Return Result:
- A value of the same type as the input expression.
Example:
Not Equal (!=)
Function: Compares two expressions and returns true if they are not equal.
Parameters:
expr1
: Boolean type expression.expr2
: Expression of the same type asexpr1
.
Return Result:
- Boolean value.
Example:
Modulus (%)
Function: Returns the remainder of the division of two numeric expressions.
Parameters:
expr1
: Numeric type expression, including float, double, decimal, tinyint, smallint, int, bigint.expr2
: Expression of the same type asexpr1
.
Return Value:
- Value of the same type as the input parameters.
Example:
Multiplication (*)
Function: Returns the product of two numeric expressions.
Parameters:
expr1
: Numeric type expression, including float, double, decimal, tinyint, smallint, int, bigint.expr2
: Expression of the same type asexpr1
.
Return Result:
- Value of the same type as the input parameters.
Example:
Addition (+)
Function: Returns the sum of two numeric expressions.
Parameters:
expr1
: Numeric type expression, including float, double, decimal, tinyint, smallint, int, bigint.expr2
: Expression of the same type asexpr1
.
Return Result:
- Value of the same type as the input parameters.
Example:
Positive Sign (+)
Function: Returns the value of the expression without making any changes.
Parameters:
expr
: Numeric type expression.
Return Result:
- Value of the same type as the input parameter.
Example:
Subtraction (-)
Function: Returns the difference between two numeric expressions.
Parameters:
expr1
: Numeric type expression, including float, double, decimal, tinyint, smallint, int, bigint.expr2
: Expression of the same type asexpr1
.
Return Result:
- Value of the same type as the input parameters.
Example:
Negative Sign (-)
Function: Returns the negative value of the expression.
Parameters:
expr
: Numeric type expression.
Return Result:
- Value of the same type as the input parameter.
Example:
Division (/)
Function: Returns the quotient of dividing two numeric expressions.
Parameters:
expr1
: Numeric type expression, including float, double, decimal.expr2
: Expression of the same type asexpr1
.
Return Result:
- Value of the same type as the input parameters.
Example: