Operators

There are two types of operators: SQL logical operators, and mathematical operators.

SQL Logical Operators

The following SQL logical operators are used to specify comparisons between expressions.

  • Between: Used to determine boundaries for a condition. Each boundary is an expression, and the bounds do not include the boundary limits, as in less than and greater than (as opposed to less than or equal to and greater than or equal to). BETWEEN can be preceded with NOT to negate the condition.

  • In: Specifies a comparison of a column value with a set of values.

  • Is Null: Specifies a comparison of a column value with the null value.

  • Like: Specifies a comparison to a literal value. Often used with wildcard characters to indicate any character string match of zero or more characters (%) or a any single character match (_).

Mathematical Operators

Mathematical operators are used to combine expression elements to make certain types of comparisons in an expression.

This table shows Mathematical Operators and their description
Operator Description
+ Plus sign for addition.
- Minus sign for subtraction.
* Multiply sign for multiplication.
/ Divide by sign for division.
|| Character string concatenation.
( Open parenthesis.
) Closed parenthesis.
> Greater than sign, indicating values higher than the comparison.
< Less than sign, indicating values lower than the comparison.
= Equal sign, indicating the same value.
<= Less than or equal to sign, indicating values the same or lower than the comparison.
>= Greater than or equal to sign, indicating values the same or higher than the comparison.
<> Not equal to, indicating values higher or lower, but different.
AND AND connective, indicating intersection with one or more conditions to form a compound condition.
OR OR connective, indicating the union with one or more conditions to form a compound condition.
NOT NOT connective, indicating a condition is not met.
, Comma, used to separate elements in a list.