What is SQL Operators ?
SQL operators are a class of comparative functions and are widely used within stories of statements selection.
SQL operators are reserved keywords used in the WHERE clause of SQL statement to perform arithmetic operators, logical and comparison operators.
Types of Operators :-
Arithmetic Operators
Arithmetic opertaors are used to perform arithmetical operations on numeric operands.
Arithmetic Operators
Operator | Operation | Description |
---|---|---|
+ | Addition | It is used to add values of both operand |
- | Substraction | It is used to subtract right hand side value from the left hand side value |
* | Multiplication | Multiples the values present on each side of the operator |
% | Modulus | Divides left hand operand by right hand operand and returns remainder. |
/ | Divide | Divides left hand operand by right hand operand. |
Comparison Operators
The two expressions are compared using the comparison operator.Let us assume two variables "A" and "B", the value of "A" is 50 and the value of "B" is 100.
Comparison Operators
Operator | Operation | Description |
---|---|---|
= | Equal to | Check both operands value that are equal or not,if yes condition become true. |
> | Greater Than | Check the left operand value is greater than right Operand, if yes condition becomes true. |
< | Less Than | Check the left operand value is less than right Operand, if yes condition becomes true. |
>= | Greater Than or equal to | Check that the value of left operand is greater than or equal to the value of right operand or not,if yes condition become true. |
<= | Less Than or equal to | Examines that the value of left operand is less than or equal to the value of right operand or not, if yes condition becomes true. |
<> | Not equal to | Check the operand's value equal or not, if values are not equal condition is true. |
Logical Operators
Here is a list of all logical operators available in SQL.Logical Operators
Operator | Description |
---|---|
ALL | It is used to compare a value to a value in another value set. |
AND | This operator allows the existence of multiple conditions in an SQL statement. |
ANY | This operator is used to compare the any applicable value the condition. |
BETWEEN | The BETWEEN operator is used to search for values. |
EXISTS | This operator is used to search for the presence of a row in a specified table. |
IN | The use of the IN operator is done from a list of values of the value that has been specified. |
LIKE | This operator is used to compare a value to similar values using wildcard operator |
NOT | This operator used to displays a record if the condition(s) is NOT TRUE |
OR | This operator is used to combine multiple conditions in SQL statements. |
Bitwise Operators
Bitwise operators convert two integer values to binary bits.Bitwise Operators
Operator | Description |
---|---|
& | Bitwise AND |
| | Bitwise OR |
^ | Bitwise exclusive OR |
0 Comments