SQL Operators

SQL Operators

SQL operators are of different types. The types of operators include arithmetic operators, bitwise operators, comparison operators, compound operators, logical operators. These operators are used mainly in the WHERE clause, HAVING clause to filter the data to be selected.

SQL Arithmetic Operators

These operators are used for arithmetic operations.

Operator Description
+ Add
- Subtract
* Multiply
/ Divide
% Modulo

SQL Comparison Operators:

Comparison operators are used to compare the column data with specific values in a condition.
Comparison Operators are also used along with the SELECT statement to filter data based on specific conditions.

Operator Description
= Equal
<> Not equal. Note: In some versions of SQL this operator may be written as !=
> Greater than
< Less than
>= Greater than or equal
<= Less than or equal
BETWEEN Between an inclusive range
LIKE Search for a pattern
IN To specify multiple possible values for a column
Learn more about BETWEEN, LIKE, IN here.

SQL Bitwise Operator

These operators are used when you have to do Bitwise operations.

Operator Description
& Bitwise AND
| Bitwise OR
^ Bitwise exclusive OR

SQL Compound Operators

Compund operators
Operator Description
+= Add equals
-= Subtract equals
*= Multiply equals
/= Divide equals
%= Modulo equals
&= Bitwise AND equals
^-= Bitwise exclusive equals
|*= Bitwise OR equals

SQL Logical Operators

There are three main Logical Operators namely AND, OR and NOT. Other logical operators include ANY, BETWEEN, EXISTS, IN, LIKE, SOME.

Pre - SQL WHERE Clause Next - SQL Logical Operators

Comments