# Operators

## **Arithmetic Operators**

Arithmetic operators perform mathematical calculations between numeric columns or expressions.

* `+` (Addition) - Adds two values together.

```sql
SELECT 10 + 5;
```

* `-` (Subtraction) - Subtracts one value from another.

```sql
SELECT 12 - 3; 
```

* `*` (Multiplication) - Multiplies two values.

```sql
SELECT 2 * 8;
```

* `/` (Division) - Divides one value by another.

```sql
SELECT 10 / 5; 
```

* `%` (Modulo) - Returns the remainder after division.

```sql
SELECT 10 % 3;
```

## **Bitwise Operators**

Bitwise operators perform binary logic between numeric values at the individual bit level.

* `&` (Bitwise AND) - Compares bits and returns 1 only if both bits are 1.
* `|` (Bitwise OR) - Compares bits and returns 1 if either bit is 1.
* `^` (Bitwise XOR) - Compares bits and returns 1 if the bits are different.

## **Comparison Operators**

Comparison operators test for logical conditions between expressions.

* `=` (Equal) - Checks for equality between two values.
* `>` (Greater than) - Checks if left value is greater than right value.
* `<` (Less than) - Checks if left value is less than right value.
* `>=` (Greater than or equal to) - Checks for greater or equal condition.
* `<=` (Less than or equal to) - Checks for less than or equal condition.
* `<>` or `!=` (Not equal to) - Checks for inequality between two values.

## **Compound Assignment Operators**

Compound operators provide shorthand for performing an operation and assignment.

* `+=` (Add equals) - Add and assign e.g. `x += 5` (x = x + 5)
* `-=` (Subtract equals)
* `*=` (Multiply equals)
* `/=` (Divide equals)
* `%=` (Modulo equals)

## **Logical Operators**

Logical operators test for complex logical conditions involving multiple operators.

* `ALL` - TRUE if all subquery values meet a condition.
* `AND` - TRUE if all conditions are TRUE.
* `ANY` - TRUE if any subquery values meet a condition.
* `BETWEEN` - TRUE if within a range.
* `EXISTS` - TRUE if subquery returns rows.
* `IN` - TRUE if equal to value in list.
* `LIKE` - TRUE if matches a pattern.
* `NOT` - Inverts a condition's meaning.
* `OR` - TRUE if any condition is TRUE.
* `SOME` - TRUE if any subquery values meet a condition.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://qatesting.gitbook.io/qa/database-testing/sql/dml-commands/operators.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
