> For the complete documentation index, see [llms.txt](https://upsolver.gitbook.io/content/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://upsolver.gitbook.io/content/reference-1/functions-and-operators/operators/comparison.md).

# Comparison

## Comparison operators <a href="#comparison-operators" id="comparison-operators"></a>

<table><thead><tr><th width="229">Operator</th><th>Description</th></tr></thead><tbody><tr><td><code>&#x3C;</code></td><td><a href="#less-than">Less than</a></td></tr><tr><td><code>></code></td><td><a href="#greater-than">Greater than</a></td></tr><tr><td><code>&#x3C;=</code></td><td><a href="#less-than-or-equal-to">Less than or equal to</a></td></tr><tr><td><code>>=</code></td><td><a href="#greater-than-or-equal-to">Greater than or equal to</a></td></tr><tr><td><code>=</code></td><td><a href="#equal">Equal</a></td></tr><tr><td><code>==</code></td><td><a href="#equal">Equal</a> (non-standard but popular syntax)</td></tr><tr><td><code>&#x3C;></code></td><td><a href="#not-equal">Not equal</a></td></tr><tr><td><code>!=</code></td><td><a href="#not-equal">Not equal</a> (non-standard but popular syntax)</td></tr></tbody></table>

## Less than

Returns `true` when the first value is less than the second value (e.g. `2 < 1` returns `false` while `1 < 2` would return `true`).

### Example

#### SQL

```sql
CREATE JOB function_operator_example
    ADD_MISSING_COLUMNS = true	
AS INSERT INTO default_glue_catalog.upsolver_samples.orders_transformed_data 
  MAP_COLUMNS_BY_NAME
    SELECT 
        orderid,
        nettotal
    FROM default_glue_catalog.upsolver_samples.orders_raw_data 
    WHERE ($commit_time BETWEEN run_start_time() AND run_end_time())
    AND nettotal < 500
    LIMIT 3;
```

#### Query result

| orderid    | nettotal |
| ---------- | -------- |
| 229NOEFdC5 | 0        |
| uCTz0C6fB8 | 128      |
| FGliNwk2lb | 381.21   |

## Greater than

Returns `true` when the first value is greater than the second value (e.g. `1 > 2` returns `false` while `2 > 1` would return `true`).

### Example

#### SQL

```sql
CREATE JOB function_operator_example
    ADD_MISSING_COLUMNS = true	
AS INSERT INTO default_glue_catalog.upsolver_samples.orders_transformed_data 
        MAP_COLUMNS_BY_NAME
    SELECT 
        orderid,
        nettotal
    FROM default_glue_catalog.upsolver_samples.orders_raw_data 
    WHERE ($commit_time BETWEEN run_start_time() AND run_end_time())
    AND nettotal > 500
    LIMIT 3;
```

#### Query result

| orderid    | nettotal |
| ---------- | -------- |
| BegfDveBnB | 865.4    |
| nxeYxV9ojw | 1261.62  |
| RVsaqkW46f | 2549.26  |

## Less than or equal to

Returns `true` when the first value is less than or equal to the second value (e.g. `1.1 <= 1` returns `false` while `1 <= 1` would return `true`).

### Example

#### SQL

```sql
CREATE JOB function_operator_example
    ADD_MISSING_COLUMNS = true	
AS INSERT INTO default_glue_catalog.upsolver_samples.orders_transformed_data 
        MAP_COLUMNS_BY_NAME
    SELECT 
        orderid,
        nettotal
    FROM default_glue_catalog.upsolver_samples.orders_raw_data 
    WHERE ($commit_time BETWEEN run_start_time() AND run_end_time())
    AND nettotal <= 500
    LIMIT 3;
```

#### Query result

| orderid    | nettotal |
| ---------- | -------- |
| UJvGCRv2hO | 217.98   |
| k95KKOBHxi | 231.03   |
| Ba3bKHFKvq | 0        |

## Greater than or equal to

Returns `true` when the first value is greater than or equal to the second value (e.g. `1 >= 1.1` returns `false` while `1 >= 1` would return `true`).

### Example

#### SQL

```sql
CREATE JOB function_operator_example
    ADD_MISSING_COLUMNS = true	
AS INSERT INTO default_glue_catalog.upsolver_samples.orders_transformed_data 
        MAP_COLUMNS_BY_NAME
    SELECT 
        orderid,
        nettotal
    FROM default_glue_catalog.upsolver_samples.orders_raw_data 
    WHERE ($commit_time BETWEEN run_start_time() AND run_end_time())
    AND nettotal >= 500
    LIMIT 3;
```

#### Query result

| orderid    | nettotal |
| ---------- | -------- |
| ShCjHSzsEy | 817.18   |
| BJNVAJHS97 | 1145.89  |
| 9TyAPyua8A | 1913.95  |

## Equal

Returns `true` when the first value is equal to the second value (e.g. `1 = 2` returns `false` while `1 = 1` would return `true`).

### Example

#### SQL

```sql
CREATE JOB function_operator_example
    ADD_MISSING_COLUMNS = true	
AS INSERT INTO default_glue_catalog.upsolver_samples.orders_transformed_data 
        MAP_COLUMNS_BY_NAME
    SELECT 
        orderid,
        shippinginfo_address_city
    FROM default_glue_catalog.upsolver_samples.orders_raw_data 
    WHERE ($commit_time BETWEEN run_start_time() AND run_end_time())
    AND shippinginfo_address_state = 'NY'
    LIMIT 3;
```

#### Query result

| orderid    | shippinginfo\_address\_city |
| ---------- | --------------------------- |
| SDdDy6C7qO | Rochester                   |
| 8ZNYcSSY0B | East Meadow                 |
| 8lfbwMVMoY | Shirley                     |

## Not equal

Returns `true` when the first value is equal to the second value (e.g. `1 != 1` returns `false` while `1 != 2` would return `true`).

### Example

#### SQL

```sql
CREATE JOB function_operator_example
    ADD_MISSING_COLUMNS = true	
AS INSERT INTO default_glue_catalog.upsolver_samples.orders_transformed_data 
        MAP_COLUMNS_BY_NAME
    SELECT 
        orderid,
        shippinginfo_address_state
    FROM default_glue_catalog.upsolver_samples.orders_raw_data 
    WHERE ($commit_time BETWEEN run_start_time() AND run_end_time())
    AND shippinginfo_address_state != 'NY'
    LIMIT 3;
```

#### Query result

| orderid    | shippinginfo\_address\_state |
| ---------- | ---------------------------- |
| aMIV6S5euH | ND                           |
| mRmHJfMDey | MD                           |
| UCQjGukrlW | KY                           |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://upsolver.gitbook.io/content/reference-1/functions-and-operators/operators/comparison.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
