# Operators

## Content

DataConnector supports multiple data operations using different operations. The tables below describe following operators with examples:

### Arithmetic operators

| **Operator** | **Description** | **Example** |
| -------- | ----------- | ------- |
| + (Addition) | Adds values on either side of the operator. | a + b will give 30 |
| \- \(Subtraction\) | Subtracts the right hand operand from the left hand operand. | a - b will give -10 |
| \* (Multiplication) | Multiplies values on either side of the operator. | a \* b will give 200 |
| / (Division) | Divides the left hand operand by the right hand operand. | b / a will give 2 |
| % (Modulus) | Divides the left hand operand by the right hand operand and returns the remainder. | b % a will give 0 |

### Comparison operators

| **Operator** | **Description** | **Example** |
| -------- | ----------- | ------- |
| = | Checks if the values of two operands are equal or not, if yes then the condition becomes true. | (a = b) is not true. |
| != | Checks if the values of two operands are equal or not, if the values are not equal, then the condition becomes true. | (a != b) is true. |
| <> | Checks if the values of two operands are equal or not, if the values are not equal, then the condition becomes true. | (a <> b) is true. |
| > | Checks if the values of the left operand is greater than the value of the right operand, if yes then the condition becomes true. | (a > b) is not true. |
| < | Checks if the values of the left operand is less than the value of the right operand, if yes then the condition becomes true. | (a < b) is true. |
| \>= | Checks if the value of the left operand is greater than or equal to the value of the right operand, if yes then the condition becomes true. | (a >= b) is not true. |
| <= | Checks if the value of the left operand is less than or equal to the value of the right operand, if yes then the condition becomes true. | (a <= b) is true. |

### Bitwise operators

| **Operator** | **Description** | **Example** |
| -------- | ----------- | ------- |
| & | Binary AND Operator copies a bit to the result, if it exists in both operands. | (A & B) will give 12 which is 0000 1100 |
| \| | Binary OR Operator copies a bit, if it exists in either operand. | \(A \| B\) will give 61 which is 0011 1101 |
| \~ | Binary Ones Complement Operator is unary and has the effect of 'flipping' bits. | (\~A ) will give -61 which is 1100 0011 in 2's complement form due to a signed binary number |
| << | Binary Left Shift Operator. The left operands value is moved left by the number of bits specified by the right operand. | A << 2 will give 240 which is 1111 0000 |
| \>\> | Binary Right Shift Operator. The left operands value is moved right by the number of bits specified by the right operand. | A >> 2 will give 15 which is 0000 1111 |

### Logical operators

| **Operator** | **Description** |
| -------- | ----------- |
| AND | The AND operator allows the existence of multiple conditions in an SQL statement's WHERE clause. |
| OR | The OR operator is used to combine multiple conditions in an SQL statement's WHERE clause. |
| EXISTS | The EXISTS operator is used to search for the presence of a row in a specified table that meets certain criteria. <br>\> \!type=note<br>><br>\> The 'EXISTS' operator only works when 'Use Cache=true'\. It does not work with 'Use Cache=false' until the related issue is fixed\. |
| IN | The IN operator is used to compare a value to a list of literal values that have been specified. |
| NOT IN | The negation of IN operator which is used to compare a value to a list of literal values that have been specified. |
| IS | The IS operator work like = |
| IS NOT | The IS operator work like != |
| LIKE | The LIKE operator is used to compare a value to similar values using wildcard operators. |
| NOT LIKE | The negation of LIKE operator which is used to compare a value to similar values using wildcard operators. |
| BETWEEN | The BETWEEN operator is used to search for values that are within a set of values, given the minimum value and the maximum value. |
