SQL Operator List

SQL Operator List


SQL statements generally contain some reserved words or characters that are used to perform operations such as comparison and arithmetical operations etc. These reserved words or characters are known as operators.

Operators are used to specify conditions in an SQL statement and to serve as conjunctions for multiple conditions in a statement.


Types Of Operators

There are 3 types of operators used in SQL statements:

  • Arithmatic Operators
  • Comparision Operators
  • Logical Operators




Arithmatic Operators

These operator are used to perform arithmatical operations. Below is a list of arithmatic operators:

Let's assume two variables "X" and "Y". Here "X" is valued 20 and "Y" valued 10.

Operator Description Example
+ It returns addition of both variables. X + Y = 30
- It returns subtraction of both variables. X - Y = 10
* It returns multiplication of both variables. X * Y = 200
/ It returns divition of both variables. X / Y = 2
% It returns remainder of divition. X % Y = 0

Comparision Operators

These operator are used to compare two values and will return a boolean value "true" or "false". Below is a list of comparision operators:

Let's assume two variables "X" and "Y". Here "X" is valued 20 and "Y" valued 10.

Operator Description Example
= It returns "true" if both values are equal, otherwise "false". (X = Y) return "false"
<> It returns "true" if both values are not equal, otherwise "true". (X <> Y) return "true"
< It returns "true" if first value less than second value, otherwise "false". (X < Y) return "false"
<= It returns "true" if first value less than or equal to second value, otherwise "false". (X <= Y) return "false"
> It returns "true" if first value greater than second value, otherwise "false". (X > Y) return "true"
>= It returns "true" if first value greater than or equal to second value, otherwise "false". (X >= Y) return "true"




Logical Operators

These operator are used to perform specific actions. Below is a list of logical operators:

Operator Description
AND It is used to create multiple conditions in a sql statement. It returns "true" if all conditions are success, otherwise "false".
OR It is used to create multiple conditions in a sql statement. It returns "true" if at least one condition is success, otherwise "false".
NOT The NOT operator reverse the meaning of any logical operator.
BETWEEN It is used to search for values, that are within a set of range.
IN It is used to compare a value from a specified list of values.
LIKE It is used to compare a value to similar values in a string using wildcard character.