SQL
SQL Operator

SQL Operators

SQL operators are used to perform operations on data in SQL statements. These are mainly categorized into:

  • Arithmetic Operators
  • Comparison Operators
  • Logical Operators

SQL Arithmetic Operators

OperatorDescription
+Adds values of both operands.
-Subtracts the right-hand operand from the left-hand operand.
*Multiplies values of both operands.
/Divides the left-hand operand by the right-hand operand.
%Returns the remainder of the division between two operands.

SQL Comparison Operators

OperatorDescription
=Checks if the values of two operands are equal.
!=Checks if the values of two operands are not equal.
<>Same as !=, checks for inequality.
>Checks if the left operand is greater than the right operand.
<Checks if the left operand is less than the right operand.
>=Checks if the left operand is greater than or equal to the right operand.
<=Checks if the left operand is less than or equal to the right operand.
!>Checks if the left operand is not greater than the right operand.
!<Checks if the left operand is not less than the right operand.

SQL Logical Operators

OperatorDescription
ANDReturns true if both conditions are true.
ORReturns true if any one condition is true.
NOTReverses the result of the condition (i.e., true becomes false, and vice versa).