# Logical Operators

#### \<expr1>  <mark style="color:purple;">AND</mark>  \<expr2>

Returns true if both the values evaluate to true.

```sql
> select colA from table1 where colB > x AND colB <> y;
```

#### \<expr1>  <mark style="color:purple;">OR</mark>  \<expr2>

Returns true if any of the values evaluate to true.

```sql
> select colA from table1 where colB > x OR colB = null;
```

#### <mark style="color:purple;">NOT</mark>  \<expr>

Returns true if the value is false.

```sql
> select colA from table1 where colB NOT y;
```

The following truth table demonstrates the boolean output of `AND` and `OR:`

| a     | b     | a AND b | a OR b |
| ----- | ----- | ------- | ------ |
| true  | true  | true    | true   |
| true  | false | false   | true   |
| false | true  | false   | true   |
| false | false | false   | false  |


---

# 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://docs.e6data.com/product-documentation/sql-command-reference/logical-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.
