Summary -
In this topic, we described about the Operators Reference in detail.
SQL Operators are classified into different types as Arithmetic, Character, Comparison, Logical, Bitwise, Set Operators that are listed as follows –
SQL Arithmetic operators are listed as follows -
Operato | Operation Name | Description |
---|---|---|
+ (Unary) | Unary Addition | Makes Operand positive |
-(Unary) | Unary Minus | Makes operand negative |
+ | Addition | Adds the value of both operands. |
- | Subtraction | Subtract the right-hand operand from the left-hand operand. |
* | Multiplication | Multiply the values of both operands. |
/ | Division | Divide the left-hand operand by the right-hand operand and gives the result |
% | Modulus | Divide the left-hand operand by the right-hand operand and returns the remainder. |
SQL Character operators are listed as follows –
Operator | Operation Name | Description |
---|---|---|
|| | Concatenate Operator | Concatenate the two strings or a string with column values. |
SQL Comparison operators are listed as follows –
Operator | Operation Name | Description |
---|---|---|
= | Equal | Checks if column values are equal to the specified value, then matched results get displayed. If no matches, then no results displayed. |
!= | Not Equal | Checks if column values are not equal to the specified value, then matched results get displayed. If no matches, then no results displayed. |
<> | Not Equal | Checks if column values are not equal to the specified value, then matched results get displayed. If no matches, then no results displayed. |
> | Greater than | Checks if column values are greater than to the specified value, then matched results get displayed. If no matches, then no results displayed. |
< | Less than | Checks if column values are less than to the specified value, then matched results get displayed. If no matches, then no results displayed. |
>= | Greater than or equal to | Checks if column values are greater than or equal to the specified value, then matched results get displayed. If no matches, then no results displayed. |
<= | Less than or equal to | Checks if column values are less than or equal to the specified value, then matched results get displayed. If no matches, then no results displayed. |
!> | Not greater than | Checks if column values are not greater than to the specified value, then matched results get displayed. If no matches, then no results displayed. |
!< | Not less than | Checks if column values are not less than to the specified value, then matched results get displayed. If no matches, then no results displayed. |
IN | Compares with a specified list of values. | |
BETWEEN | Searches the value within the values specified. | |
ALL | Compares the value with all the values in the value set. | |
ANY | Compares the value against any value in the values set. | |
EXISTS | Searches the presence of the row in the table and sets TRUE if sub query gets single row. | |
LIKE | Searches the similar words using wildcard operator. | |
SOME | Similar to ANY operator. However, the search is restricted to some of the values present in the set of values. | |
IS NULL | Compares a value with a NULL. |
SQL logical operators are listed as follows –
Operator | Description |
---|---|
AND | Allows or combines multiple conditions in an SQL statement. |
OR | Combines multiple conditions in SQL Statement. |
NOT | Applies on logical operators only. Reverses the meaning of any logical operators. |
SQL Bitwise operators are listed as follows –
Operators | Description |
---|---|
Bitwise AND (&) | The numerical values are converted into binary values and operation is performed, result again converted into numerical form. |
Bitwise OR (|) | The numerical values are converted into binary form, then or operation is performed. |
Bitwise exclusive OR (^) | The numerical values converted into binary form, then Exclusive or operation is performed. |
SQL Set operators are listed as follows –
Operators | Description |
---|---|
UNION | Select all distinct rows selected by either query. |
UNION ALL | Returns all the rows selected from two rows including duplicates. |
INTERSECT or INTERSECT ALL | Returns all distinct rows selected by both rows. |
MINUS | Returns all distinct rows selected by the first query but not from the second one. |