---
title: shiftrightunsigned function
description: Learn the syntax of the shiftrightunsigned function of the SQL language in Databricks SQL and Databricks Runtime.
canonical_url: https://docs.databricks.com/aws/en/sql/language-manual/functions/shiftrightunsigned
---

# `shiftrightunsigned` function

**Applies to:** ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks SQL ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks Runtime

Returns `expr` bitwise unsigned right shifted by `n` bits. This function is a synonym for [`>>>` (gt gt gt sign) operator](https://docs.databricks.com/aws/en/sql/language-manual/functions/gtgtgtsign.md).

## Syntax

```
shiftrightunsigned(expr, n)
```

## Arguments

* `expr`: An `INTEGER` or `BIGINT` expression.
* `n`: An `INTEGER` expression specifying the number of bits to shift.

## Returns

The result type matches `expr`.

The effective shift distance is `n` modulo 32 for an `INTEGER` `expr` and modulo 64 for a `BIGINT` `expr`.

## Examples

```sql
> SELECT shiftrightunsigned(4, 1);
 2
> SELECT shiftrightunsigned(-4, 1);
 2147483646
> SELECT shiftrightunsigned(1, -1);
 0
> SELECT 4 >>> 1;
 2
> SELECT -4 >>> 1;
 2147483646
```

## Related functions

* [`>>>` (gt gt gt sign) operator](https://docs.databricks.com/aws/en/sql/language-manual/functions/gtgtgtsign.md)
* [`shiftleft` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/shiftleft.md)
* [`shiftright` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/shiftright.md)
