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

# `hash` 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 a hash value of the arguments.

## Syntax

```
hash(expr1, ...)
```

## Arguments

* `exprN`: An expression of any type.

## Returns

An INTEGER.

> [!NOTE]
>
> The hash value depends on the input data type. For example, `hash(1::INT)` produces a different result than `hash(1::BIGINT)`. If your use case requires stable hash values across different data types, consider explicitly casting values to the desired type.

## Examples

```sql
> SELECT hash('Spark', array(123), 2);
 -1321691492
```

## Related functions

* [`crc32` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/crc32.md)
* [`md5` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/md5.md)
* [`sha` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/sha.md)
* [`sha1` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/sha1.md)
* [`sha2` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/sha2.md)
* [`xxhash64` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/xxhash64.md)
