# 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
```
