# Bitwise Functions

#### <mark style="color:purple;">BITWISE\_OR(</mark> \<expr>, \<expr> <mark style="color:purple;">)</mark>

Returns the bitwise OR of two numeric expressions.

<pre class="language-sql"><code class="lang-sql"><strong>> select bitwise_or(3,5);
</strong><strong>7
</strong></code></pre>

#### <mark style="color:purple;">BITWISE\_XOR(</mark> \<expr>, \<expr> <mark style="color:purple;">)</mark>

Returns the bitwise XOR of two numeric expressions.

<pre class="language-sql"><code class="lang-sql">> select bitwise_xor(3,5);
<strong>6
</strong></code></pre>

#### <mark style="color:purple;">BITWISE\_NOT(</mark> \<expr><mark style="color:purple;">)</mark>

Returns the bitwise negation of a numeric expression.

<pre class="language-sql"><code class="lang-sql"><strong>> select bitwise_not(4);
</strong><strong>-5
</strong></code></pre>

#### <mark style="color:purple;">SHIFTRIGHT (</mark> \<expr>, \<n> <mark style="color:purple;">)</mark>

Alternate syntax: `<expr>`` `<mark style="color:purple;">`>>`</mark>` ``n;`

Returns a bitwise signed right shifted by `n` bits.

```sql
> select shiftright(2, 1);
1
```

<pre class="language-sql"><code class="lang-sql"><strong>> select 2 >> 1;
</strong><strong>1
</strong></code></pre>

#### <mark style="color:purple;">SHIFTLEFT (</mark> \<expr>, \<n> <mark style="color:purple;">)</mark>

Alternate syntax: `<expr>`` `<mark style="color:purple;">`<<`</mark>` ``n;`

Returns a bitwise signed left shifted by `n` bits.

```sql
> select shiftleft(2, 1);
4
```

```sql
> select 2 << 1;
4
```


---

# 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/bitwise-functions.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.
