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

# `shiftleft` 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 left shifted by `n` bits. This function is a synonym for [`<<` (lt lt sign) operator](https://docs.databricks.com/aws/en/sql/language-manual/functions/ltltsign.md).

## Syntax

```
shiftleft(expr, n)
```

## Arguments

* `expr`: An `INTEGER` or `BIGINT` expression.
* `n`: An `INTEGER` expression.

## Returns

The result matches the type of `expr`.

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

## Examples

```sql
> SELECT shiftleft(2, 1);
 4
> SELECT shiftleft(1, -1);
 -2147483648
> SELECT 2 << 1;
 4
```

## Related functions

* [`<<` (lt lt sign) operator](https://docs.databricks.com/aws/en/sql/language-manual/functions/ltltsign.md)
* [`shiftright` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/shiftright.md)
* [`shiftrightunsigned` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/shiftrightunsigned.md)
