---
title: Built-in functions
description: The built-in operators and functions for strings, numbers, dates, arrays, maps, and JSON, in Databricks SQL and Databricks Runtime.
canonical_url: https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-functions-builtin
---

# Built-in functions

**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

This article presents links to and descriptions of built-in operators and functions for strings and binary types, numeric scalars, aggregations, windows, arrays, maps, dates and timestamps, casting, CSV data, JSON data, XPath manipulation, and other miscellaneous functions.

For use cases that are not supported by existing built-in functions, consider defining a custom function. See [What are user-defined functions (UDFs)?](https://docs.databricks.com/aws/en/udf/index.md).

Also see:

* [Alphabetical list of built-in functions](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-functions-builtin-alpha.md)

## Operators and predicates

For information on how operators are parsed with respect to each other, see [Operator precedence](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-functions-builtin.md#operator-precedence).

| Operator                                                                                           | Syntax                                               | Description                                                                                                                                   |
| -------------------------------------------------------------------------------------------------- | ---------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| [&](https://docs.databricks.com/aws/en/sql/language-manual/functions/ampersandsign.md)             | `expr1 & expr2`                                      | Returns the bitwise `AND` of `expr1` and `expr2`.                                                                                             |
| [and](https://docs.databricks.com/aws/en/sql/language-manual/functions/and.md)                     | `expr1 and expr2`                                    | Returns the logical `AND` of `expr1` and `expr2`.                                                                                             |
| [\*](https://docs.databricks.com/aws/en/sql/language-manual/functions/asterisksign.md)             | `multiplier * multiplicand`                          | Returns `multiplier` multiplied by `multiplicand`.                                                                                            |
| [!=](https://docs.databricks.com/aws/en/sql/language-manual/functions/bangeqsign.md)               | `expr1 != expr2`                                     | Returns true if `expr1` does not equal `expr2`, or `false` otherwise.                                                                         |
| [!](https://docs.databricks.com/aws/en/sql/language-manual/functions/bangsign.md)                  | `!expr`                                              | Returns the logical `NOT` of a Boolean expression.                                                                                            |
| [between](https://docs.databricks.com/aws/en/sql/language-manual/functions/between.md)             | `expr1 [not] between expr2 and expr3`                | Tests whether `expr1` is greater or equal than `expr2` and less than or equal to `expr3`.                                                     |
| [\[\]](https://docs.databricks.com/aws/en/sql/language-manual/functions/bracketsign.md)            | `arrayExpr [ indexExpr ]`                            | Returns `indexExpr`nd element of `ARRAY` `arrayExpr`.                                                                                         |
| [\[\]](https://docs.databricks.com/aws/en/sql/language-manual/functions/bracketsign.md)            | `mapExpr [ keyExpr ]`                                | Returns value at `keyExpr` of `MAP` `mapExpr`.                                                                                                |
| [^](https://docs.databricks.com/aws/en/sql/language-manual/functions/caretsign.md)                 | `expr1 ^ expr2`                                      | Returns the bitwise exclusive `OR (XOR)` of `expr1` and `expr2`.                                                                              |
| [:](https://docs.databricks.com/aws/en/sql/language-manual/functions/colonsign.md)                 | `jsonStr : jsonPath`                                 | Returns fields extracted from the `jsonStr`.                                                                                                  |
| [::](https://docs.databricks.com/aws/en/sql/language-manual/functions/coloncolonsign.md)           | `expr :: type`                                       | Casts the value `expr` to the target data type `type`.                                                                                        |
| [?::](https://docs.databricks.com/aws/en/sql/language-manual/functions/questiondoublecolonsign.md) | `expr ?:: type`                                      | Casts the value `expr` to the target data type `type` if possible, returns `NULL` otherwise.                                                  |
| [div](https://docs.databricks.com/aws/en/sql/language-manual/functions/div.md)                     | `dividend div divisor`                               | Returns the integral part of the division of `dividend` by `divisor`.                                                                         |
| [.](https://docs.databricks.com/aws/en/sql/language-manual/functions/dotsign.md)                   | `mapExpr . keyIdentifier`                            | Returns a `MAP` value by `keyIdentifier`.                                                                                                     |
| [.](https://docs.databricks.com/aws/en/sql/language-manual/functions/dotsign.md)                   | `structExpr . fieldIdentifier`                       | Returns a `STRUCT` field by `fieldIdentifier`.                                                                                                |
| [==](https://docs.databricks.com/aws/en/sql/language-manual/functions/eqeqsign.md)                 | `expr1 == expr2`                                     | Returns `true` if `expr1` equals `expr2`, or `false` otherwise.                                                                               |
| [=](https://docs.databricks.com/aws/en/sql/language-manual/functions/eqsign.md)                    | `expr1 = expr2`                                      | Returns `true` if `expr1` equals `expr2`, or `false` otherwise.                                                                               |
| [>=](https://docs.databricks.com/aws/en/sql/language-manual/functions/gteqsign.md)                 | `expr1 >= expr2`                                     | Returns `true` if `expr1` is greater than or equal to `expr2`, or `false` otherwise.                                                          |
| [>](https://docs.databricks.com/aws/en/sql/language-manual/functions/gtsign.md)                    | `expr1 > expr2`                                      | Returns `true` if `expr1` is greater than `expr2`, or `false` otherwise.                                                                      |
| [>>](https://docs.databricks.com/aws/en/sql/language-manual/functions/gtgtsign.md)                 | `expr >> n`                                          | Returns `expr` bitwise signed right shifted by `n` bits.                                                                                      |
| [>>>](https://docs.databricks.com/aws/en/sql/language-manual/functions/gtgtgtsign.md)              | `expr >>> n`                                         | Returns `expr` bitwise unsigned right shifted by `n` bits.                                                                                    |
| [exists](https://docs.databricks.com/aws/en/sql/language-manual/functions/exists.md)               | `exists(query)`                                      | Returns true if `query` returns at least one row, or false otherwise.                                                                         |
| [ilike](https://docs.databricks.com/aws/en/sql/language-manual/functions/ilike.md)                 | `str [not] ilike (pattern[ESCAPE escape])`           | Returns true if `str` does (not) match `pattern` with `escape` case-insensitively.                                                            |
| [ilike](https://docs.databricks.com/aws/en/sql/language-manual/functions/ilike.md)                 | `str [not] ilike {ANY\|SOME\|ALL}([pattern[, ...]])` | Returns true if `str` does (not) match any/all patterns case-insensitively.                                                                   |
| [in](https://docs.databricks.com/aws/en/sql/language-manual/functions/in.md)                       | `elem [not] in (expr1[, ...])`                       | Returns `true` if `elem` does (not) equal any `exprN`.                                                                                        |
| [in](https://docs.databricks.com/aws/en/sql/language-manual/functions/in.md)                       | `elem [not] in (query)`                              | Returns `true` if `elem` does (not) equal any row in `query`.                                                                                 |
| [is distinct](https://docs.databricks.com/aws/en/sql/language-manual/functions/isdistinct.md)      | `expr1 is [not] distinct from expr2`                 | Tests whether the arguments do (not) have different values where `NULL`s are considered as comparable values.                                 |
| [is false](https://docs.databricks.com/aws/en/sql/language-manual/functions/isfalse.md)            | `expr is [not] false`                                | Tests whether `expr` is (not) `false`.                                                                                                        |
| [is null](https://docs.databricks.com/aws/en/sql/language-manual/functions/isnull.md)              | `expr is [not] null`                                 | Returns `true` if `expr` is (not) `NULL`.                                                                                                     |
| [is true](https://docs.databricks.com/aws/en/sql/language-manual/functions/istrue.md)              | `expr is [not] true`                                 | Tests whether `expr` is (not) `true`.                                                                                                         |
| [like](https://docs.databricks.com/aws/en/sql/language-manual/functions/like.md)                   | `str [not] like (pattern[ESCAPE escape])`            | Returns true if `str` does (not) match `pattern` with `escape`.                                                                               |
| [like](https://docs.databricks.com/aws/en/sql/language-manual/functions/like.md)                   | `str [not] like {ANY\|SOME\|ALL}([pattern[, ...]])`  | Returns true if `str` does (not) match any/all patterns.                                                                                      |
| [\<=>](https://docs.databricks.com/aws/en/sql/language-manual/functions/lteqgtsign.md)             | `expr1 <=> expr2`                                    | Returns the same result as the `EQUAL(=)` for non-null operands, but returns `true` if both are `NULL`, `false` if one of the them is `NULL`. |
| [\<=](https://docs.databricks.com/aws/en/sql/language-manual/functions/lteqsign.md)                | `expr1 <= expr2`                                     | Returns `true` if `expr1` is less than or equal to `expr2`, or `false` otherwise.                                                             |
| [\<>](https://docs.databricks.com/aws/en/sql/language-manual/functions/ltgtsign.md)                | `expr1 <> expr2`                                     | Returns `true` if `expr1` does not equal `expr2`, or `false` otherwise.                                                                       |
| [\<](https://docs.databricks.com/aws/en/sql/language-manual/functions/ltsign.md)                   | `expr1 < expr2`                                      | Returns `true` if `expr1` is less than `expr2`, or `false` otherwise.                                                                         |
| [\<\<](https://docs.databricks.com/aws/en/sql/language-manual/functions/ltltsign.md)               | `expr << n`                                          | Returns `expr` bitwise left shifted by `n` bits.                                                                                              |
| [-](https://docs.databricks.com/aws/en/sql/language-manual/functions/minussign.md)                 | `expr1 - expr2`                                      | Returns the subtraction of `expr2` from `expr1`.                                                                                              |
| [not](https://docs.databricks.com/aws/en/sql/language-manual/functions/not.md)                     | `not expr`                                           | Returns the logical `NOT` of a Boolean expression.                                                                                            |
| [or](https://docs.databricks.com/aws/en/sql/language-manual/functions/or.md)                       | `expr1 or expr2`                                     | Returns the logical `OR` of `expr1` and `expr2`.                                                                                              |
| [%](https://docs.databricks.com/aws/en/sql/language-manual/functions/percentsign.md)               | `dividend % divisor`                                 | Returns the remainder after `dividend` / `divisor`.                                                                                           |
| [\|\|](https://docs.databricks.com/aws/en/sql/language-manual/functions/pipepipesign.md)           | `expr1 \|\| expr2 `                                  | Returns the concatenation of `expr1` and `expr2`.                                                                                             |
| [\|](https://docs.databricks.com/aws/en/sql/language-manual/functions/pipesign.md)                 | `expr1 \| expr2`                                     | Returns the bitwise `OR` of `expr1` and `expr2`.                                                                                              |
| [+](https://docs.databricks.com/aws/en/sql/language-manual/functions/plussign.md)                  | `expr1 + expr2`                                      | Returns the sum of `expr1` and `expr2`.                                                                                                       |
| [regexp](https://docs.databricks.com/aws/en/sql/language-manual/functions/regexp.md)               | `str [not] regexp regex`                             | Returns true if `str` does (not) match `regex`.                                                                                               |
| [regexp\_like](https://docs.databricks.com/aws/en/sql/language-manual/functions/regexp_like.md)    | `str [not] regexp_like regex`                        | Returns true if `str` does (not) match `regex`.                                                                                               |
| [rlike](https://docs.databricks.com/aws/en/sql/language-manual/functions/rlike.md)                 | `str [not] rlike regex`                              | Returns true if `str` does (not) match `regex`.                                                                                               |
| [/](https://docs.databricks.com/aws/en/sql/language-manual/functions/slashsign.md)                 | `dividend / divisor`                                 | Returns `dividend` divided by `divisor`.                                                                                                      |
| [\~](https://docs.databricks.com/aws/en/sql/language-manual/functions/tildesign.md)                | `~ expr`                                             | Returns the bitwise `NOT` of `expr`.                                                                                                          |

## Operator precedence

| Precedence | Operator                                                                                                      |
| ---------- | ------------------------------------------------------------------------------------------------------------- |
| 1          | `:`, `::`, `?::`, `[ ]`                                                                                       |
| 2          | `-`(unary), `+`(unary), `~`                                                                                   |
| 3          | `*`, `/`, `%`, `div`                                                                                          |
| 4          | `+`, `-`, `\|\|`                                                                                              |
| 5          | `<<`, `>>`, `>>>`                                                                                             |
| 6          | `&`                                                                                                           |
| 7          | `^`                                                                                                           |
| 8          | `\|`                                                                                                          |
| 9          | `=`, `==`, `<=>`, `<>`, `!=`, `<`, `<=`, `>`, `>=`                                                            |
| 10         | `not`, `exists`                                                                                               |
| 11         | `between`, `in`, `rlike`, `regexp`, `ilike`, `like`, `is [not] [NULL, true, false]`, `is [not] distinct from` |
| 12         | `and`                                                                                                         |
| 13         | `or`                                                                                                          |

## String and binary functions

For information on the pattern syntax used by the `regexp_*` functions and the `rlike` operator, see [Regular expressions](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-regexp-pattern.md).

| Function                                                                                                                                            | Description                                                                                                                                                                 |
| --------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [expr1 \|\| expr2](https://docs.databricks.com/aws/en/sql/language-manual/functions/pipepipesign.md)                                                | Returns the concatenation of `expr1` and `expr2`.                                                                                                                           |
| [aes\_decrypt(expr, key\[, mode\[, padding\[, aad\]\]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/aes_decrypt.md)          | Decrypts a binary `expr` using AES encryption.                                                                                                                              |
| [aes\_encrypt(expr, key\[, mode\[, padding\[, iv\[, aad\]\]\]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/aes_encrypt.md)  | Encrypts a binary `expr` using AES encryption.                                                                                                                              |
| [ascii(str)](https://docs.databricks.com/aws/en/sql/language-manual/functions/ascii.md)                                                             | Returns the ASCII code point of the first character of `str`.                                                                                                               |
| [base64(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/base64.md)                                                          | Converts `expr` to a base 64 string.                                                                                                                                        |
| [bin(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/bin.md)                                                                | Returns the binary representation of `expr`.                                                                                                                                |
| [binary(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/binary.md)                                                          | Casts the value of `expr` to `BINARY`.                                                                                                                                      |
| [bit\_length(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/bit_length.md)                                                 | Returns the bit length of string data or number of bits of binary data.                                                                                                     |
| [bitmap\_count(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/bitmap_count.md)                                             | Returns the number of bits set in a `BINARY` string representing a bitmap.                                                                                                  |
| [btrim(str \[, trimStr\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/btrim.md)                                               | Returns `str` with leading and trailing characters removed.                                                                                                                 |
| [char(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/char.md)                                                              | Returns the character at the supplied UTF-16 code point.                                                                                                                    |
| [char\_length(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/char_length.md)                                               | Returns the character length of string data or number of bytes of binary data.                                                                                              |
| [character\_length(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/character_length.md)                                     | Returns the character length of string data or number of bytes of binary data.                                                                                              |
| [charindex(substr, str\[, pos\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/charindex.md)                                    | Returns the position of the first occurrence of `substr` in `str` after position `pos`.                                                                                     |
| [chr(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/chr.md)                                                                | Returns the character at the supplied UTF-16 code point.                                                                                                                    |
| [strExpr collate collationName](https://docs.databricks.com/aws/en/sql/language-manual/functions/collate.md)                                        | Attaches an explicit collation `collationName` to `strExpr`.                                                                                                                |
| [collation \[for\] (strExpr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/collation.md)                                        | Returns the collation attached to `strExpr`.                                                                                                                                |
| [concat(expr1, expr2\[, …\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/concat.md)                                           | Returns the concatenation of the arguments.                                                                                                                                 |
| [concat\_ws(sep\[, expr1\[, …\]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/concat_ws.md)                                  | Returns the concatenation strings separated by `sep`.                                                                                                                       |
| [contains(expr, subExpr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/contains.md)                                             | Returns `true` if `expr` `STRING` or `BINARY` contains `subExpr`.                                                                                                           |
| [crc32(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/crc32.md)                                                            | Returns a cyclic redundancy check value of `expr`.                                                                                                                          |
| [decode(expr, charSet)](https://docs.databricks.com/aws/en/sql/language-manual/functions/decode_cs.md)                                              | Translates binary `expr` to a string using the character set encoding `charSet`.                                                                                            |
| [encode(expr, charSet)](https://docs.databricks.com/aws/en/sql/language-manual/functions/encode.md)                                                 | Returns the binary representation of a string using the `charSet` character encoding.                                                                                       |
| [endswith(expr, endExpr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/endswith.md)                                             | Returns `true` if `expr` `STRING` or `BINARY` ends with `endExpr`.                                                                                                          |
| [find\_in\_set(searchExpr, sourceExpr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/find_in_set.md)                            | Returns the position of a string within a comma-separated list of strings.                                                                                                  |
| [format\_number(expr, scale)](https://docs.databricks.com/aws/en/sql/language-manual/functions/format_number.md)                                    | Formats `expr` like `#,###,###.##`, rounded to `scale` decimal places.                                                                                                      |
| [format\_number(expr, fmt)](https://docs.databricks.com/aws/en/sql/language-manual/functions/format_number.md)                                      | Formats `expr` like `fmt`.                                                                                                                                                  |
| [format\_string(strfmt\[, obj1 \[, …\]\]) ](https://docs.databricks.com/aws/en/sql/language-manual/functions/format_string.md)                      | Returns a formatted string from printf-style format strings.                                                                                                                |
| [hex(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/hex.md)                                                                | Converts `expr` to hexadecimal.                                                                                                                                             |
| [hmac(key, message\[, algorithm\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/hmac.md)                                       | Returns the keyed-hash message authentication code (HMAC) of `message` using `key`.                                                                                         |
| [str ilike (pattern\[ESCAPE escape\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/like.md)                                    | Returns true if `str` matches `pattern` with `escape` case insensitively.                                                                                                   |
| [initcap(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/initcap.md)                                                        | Returns `expr` with the first letter of each word in uppercase.                                                                                                             |
| [instr(str, substr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/instr.md)                                                     | Returns the (1-based) index of the first occurrence of `substr` in `str`.                                                                                                   |
| [isearch(col\[, ...\], pattern\[, mode => mode\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/isearch.md)                     | Returns `true` if `pattern` is found in any of the target column values, case-insensitively.                                                                                |
| [lcase(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/lcase.md)                                                            | Returns `expr` with all characters changed to lowercase.                                                                                                                    |
| [left(str, len)](https://docs.databricks.com/aws/en/sql/language-manual/functions/left.md)                                                          | Returns the leftmost `len` characters from `str`.                                                                                                                           |
| [len(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/len.md)                                                                | Returns the character length of string data or number of bytes of binary data.                                                                                              |
| [length(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/length.md)                                                          | Returns the character length of string data or number of bytes of binary data.                                                                                              |
| [levenshtein(str1, str2)](https://docs.databricks.com/aws/en/sql/language-manual/functions/levenshtein.md)                                          | Returns the Levenshtein distance between the strings `str1` and `str2`.                                                                                                     |
| [str like (pattern\[ESCAPE escape\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/like.md)                                     | Returns true if `str` matches `pattern` with `escape`.                                                                                                                      |
| [locate(substr, str\[, pos\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/locate.md)                                          | Returns the position of the first occurrence of `substr` in `str` after position `pos`.                                                                                     |
| [lower(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/lower.md)                                                            | Returns `expr` with all characters changed to lowercase.                                                                                                                    |
| [lpad(expr, len\[, pad\]) ](https://docs.databricks.com/aws/en/sql/language-manual/functions/lpad.md)                                               | Returns `expr`, left-padded with `pad` to a length of `len`.                                                                                                                |
| [ltrim(\[trimstr,\] str)](https://docs.databricks.com/aws/en/sql/language-manual/functions/ltrim.md)                                                | Returns `str` with leading characters within `trimStr` removed.                                                                                                             |
| [mask(str\[, upperChar\[, lowerChar\[, digitChar\[, otherChar\]\]\]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/mask.md)   | Returns a masked version of the input `str`.                                                                                                                                |
| [md5(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/md5.md)                                                                | Returns an MD5 128-bit checksum of `expr` as a hex string.                                                                                                                  |
| [octet\_length(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/octet_length.md)                                             | Returns the byte length of string data or number of bytes of binary data.                                                                                                   |
| [overlay(input PLACING replace FROM pos \[FOR len\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/overlay.md)                  | Replaces `input` with `replace` that starts at `pos` and is of length `len`.                                                                                                |
| [overlay(input PLACING replace FROM pos \[FOR len\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/overlay.md)                  | Replaces `input` with `replace` that starts at `pos` and is of length `len`.                                                                                                |
| [parse\_url(url, partToExtract\[, key\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/parse_url.md)                            | Extracts a part from `url`.                                                                                                                                                 |
| [position(substr, str\[, pos\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/position.md)                                      | Returns the position of the first occurrence of `substr` in `str` after position `pos`.                                                                                     |
| [position(subtr IN str)](https://docs.databricks.com/aws/en/sql/language-manual/functions/position.md)                                              | Returns the position of the first occurrence of `substr` in `str` after position `pos`.                                                                                     |
| [printf(strfmt\[, obj1 \[, …\]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/printf.md)                                      | Returns a formatted string from printf-style format strings.                                                                                                                |
| [randstr(length)](https://docs.databricks.com/aws/en/sql/language-manual/functions/randstr.md)                                                      | Returns a random string of `length` alpha-numeric characters.                                                                                                               |
| [str regexp regex](https://docs.databricks.com/aws/en/sql/language-manual/functions/regexp.md)                                                      | Returns true if `str` matches `regex`.                                                                                                                                      |
| [str regexp\_like regex](https://docs.databricks.com/aws/en/sql/language-manual/functions/regexp_like.md)                                           | Returns true if `str` matches `regex`.                                                                                                                                      |
| [regexp\_count(str, regexp)](https://docs.databricks.com/aws/en/sql/language-manual/functions/regexp_count.md)                                      | Returns the number of times `str` matches the `regexp` pattern.                                                                                                             |
| [regexp\_extract(str, regexp\[, idx\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/regexp_extract.md)                         | Extracts the first string in `str` that matches the `regexp` expression and corresponds to the `regex` group index.                                                         |
| [regexp\_extract\_all(str, regexp\[, idx\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/regexp_extract_all.md)                | Extracts the all strings in `str` that matches the `regexp` expression and corresponds to the `regex` group index.                                                          |
| [regexp\_instr(str, regexp)](https://docs.databricks.com/aws/en/sql/language-manual/functions/regexp_instr.md)                                      | Returns the position of the first substring in `str` that matches `regexp`.                                                                                                 |
| [regexp\_replace(str, regexp, rep\[, position\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/regexp_replace.md)               | Replaces all substrings of `str` that match `regexp` with `rep`.                                                                                                            |
| [regexp\_substr(str, regexp)](https://docs.databricks.com/aws/en/sql/language-manual/functions/regexp_substr.md)                                    | Returns the first substring in `str` that matches `regexp`.                                                                                                                 |
| [repeat(expr, n)](https://docs.databricks.com/aws/en/sql/language-manual/functions/repeat.md)                                                       | Returns the string that repeats `expr` `n` times.                                                                                                                           |
| [replace(str, search \[, replace\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/replace.md)                                   | Replaces all occurrences of `search` with `replace`.                                                                                                                        |
| [reverse(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/reverse.md)                                                        | Returns a reversed string or an array with reverse order of elements.                                                                                                       |
| [right(str, len)](https://docs.databricks.com/aws/en/sql/language-manual/functions/right.md)                                                        | Returns the rightmost `len` characters from the string `str`.                                                                                                               |
| [str rlike regex](https://docs.databricks.com/aws/en/sql/language-manual/functions/rlike.md)                                                        | Returns true if `str` matches `regex`.                                                                                                                                      |
| [rpad(expr, len\[, pad\]) ](https://docs.databricks.com/aws/en/sql/language-manual/functions/rpad.md)                                               | Returns `expr`, right-padded with `pad` to a length of `len`.                                                                                                               |
| [rtrim(\[trimStr,\] str)](https://docs.databricks.com/aws/en/sql/language-manual/functions/rtrim.md)                                                | Returns `str` with trailing characters removed.                                                                                                                             |
| [search(col\[, ...\], pattern\[, mode => mode\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/search.md)                       | Returns `true` if `pattern` is found in any of the target column values.                                                                                                    |
| [sentences(str\[, lang, country\]) ](https://docs.databricks.com/aws/en/sql/language-manual/functions/sentences.md)                                 | Splits `str` into an array of array of words.                                                                                                                               |
| [sha(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/sha.md)                                                                | Returns a sha1 hash value as a hex string of `expr`.                                                                                                                        |
| [sha1(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/sha1.md)                                                              | Returns a sha1 hash value as a hex string of `expr`.                                                                                                                        |
| [sha2(expr, bitLength)](https://docs.databricks.com/aws/en/sql/language-manual/functions/sha2.md)                                                   | Returns a checksum of the SHA-2 family as a hex string of `expr`.                                                                                                           |
| [soundex(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/soundex.md)                                                        | Returns the soundex code of the string.                                                                                                                                     |
| [space(n)](https://docs.databricks.com/aws/en/sql/language-manual/functions/space.md)                                                               | Returns a string consisting of `n` spaces.                                                                                                                                  |
| [split(str, regex\[, limit\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/split.md)                                           | Splits `str` around occurrences that match `regex` and returns an array with a length of at most `limit`.                                                                   |
| [split\_part(str, delim, partNum)](https://docs.databricks.com/aws/en/sql/language-manual/functions/split_part.md)                                  | Splits `str` around occurrences of `delim` and returns the `partNum` part.                                                                                                  |
| [startswith(expr, startExpr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/startswith.md)                                       | Returns `true` if `expr` `STRING` or `BINARY` starts with `startExpr`.                                                                                                      |
| [string(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/string.md)                                                          | Casts the value `expr` to `STRING`.                                                                                                                                         |
| [substr(expr, pos\[, len\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/substr.md)                                            | Returns the substring of `expr` that starts at `pos` and is of length `len`.                                                                                                |
| [substr(expr FROM pos\[ FOR len\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/substr.md)                                     | Returns the substring of `expr` that starts at `pos` and is of length `len`.                                                                                                |
| [substring(expr, pos\[, len\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/substring.md)                                      | Returns the substring of `expr` that starts at `pos` and is of length `len`.                                                                                                |
| [substring(expr FROM pos\[ FOR len\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/substring.md)                               | Returns the substring of `expr` that starts at `pos` and is of length `len`.                                                                                                |
| [substring\_index(expr, delim, count)](https://docs.databricks.com/aws/en/sql/language-manual/functions/substring_index.md)                         | Returns the substring of `expr` before `count` occurrences of the delimiter `delim`.                                                                                        |
| [to\_binary(expr\[, fmt\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/to_binary.md)                                          | Returns `expr` cast to a Binary based on `fmt`.                                                                                                                             |
| [to\_char(numExpr, fmt)](https://docs.databricks.com/aws/en/sql/language-manual/functions/to_char.md)                                               | Returns `numExpr` cast to `STRING` using formatting `fmt`.                                                                                                                  |
| [to\_varchar(numExpr, fmt)](https://docs.databricks.com/aws/en/sql/language-manual/functions/to_varchar.md)                                         | Returns `numExpr` cast to `STRING` using formatting `fmt`.                                                                                                                  |
| [translate(expr, from, to)](https://docs.databricks.com/aws/en/sql/language-manual/functions/translate.md)                                          | Returns an `expr` where all characters in `from` have been replaced with those in `to`.                                                                                     |
| [trim(\[\[BOTH \| LEADING \| TRAILING\] \[trimStr\] FROM\] str)](https://docs.databricks.com/aws/en/sql/language-manual/functions/trim.md)          | Trim characters from a string.                                                                                                                                              |
| [try\_aes\_decrypt(expr, key\[, mode\[, padding\[, aad\]\]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_aes_decrypt.md) | Decrypts a binary `expr` using AES encryption, and return `NULL` in case of error.                                                                                          |
| [try\_to\_binary(expr \[, fmt\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_to_binary.md)                                | Returns `expr` cast to `BINARY` based on `fmt`, or `NULL` if the input is invalid.                                                                                          |
| [try\_url\_decode(str)](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_url_decode.md)                                         | Translates a string back from [application/x-www-form-urlencoded](https://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1) format, and returns `NULL` in case of error. |
| [try\_zstd\_decompress(value)](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_zstd_decompress.md)                             | Returns value decompressed with Zstandard compression, or `NULL` if the input is invalid.                                                                                   |
| [ucase(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/ucase.md)                                                            | Returns `expr` with all characters changed to uppercase.                                                                                                                    |
| [unbase64(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/unbase64.md)                                                      | Returns a decoded base64 string as binary.                                                                                                                                  |
| [unhex(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/unhex.md)                                                            | Converts hexadecimal `expr` to `BINARY`.                                                                                                                                    |
| [upper(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/upper.md)                                                            | Returns `expr` with all characters changed to uppercase.                                                                                                                    |
| [url\_decode(str)](https://docs.databricks.com/aws/en/sql/language-manual/functions/url_decode.md)                                                  | Translates a string back from [application/x-www-form-urlencoded](https://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1) format.                                      |
| [url\_encode(str)](https://docs.databricks.com/aws/en/sql/language-manual/functions/url_encode.md)                                                  | Translates a string into [application/x-www-form-urlencoded](https://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1) format.                                           |
| [zstd\_compress (value\[,level\[,streaming\_mode\]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/zstd_compress.md)           | Returns value compressed with Zstandard compression.                                                                                                                        |
| [zstd\_decompress(value)](https://docs.databricks.com/aws/en/sql/language-manual/functions/zstd_decompress.md)                                      | Returns value decompressed with Zstandard compression.                                                                                                                      |

## Numeric scalar functions

| Function                                                                                                                                               | Description                                                                                                                        |
| ------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------- |
| [\~ expr](https://docs.databricks.com/aws/en/sql/language-manual/functions/tildesign.md)                                                               | Returns the bitwise `NOT` of `expr`.                                                                                               |
| [dividend / divisor](https://docs.databricks.com/aws/en/sql/language-manual/functions/slashsign.md)                                                    | Returns `dividend` divided by `divisor`.                                                                                           |
| [expr1 \| expr2](https://docs.databricks.com/aws/en/sql/language-manual/functions/pipesign.md)                                                         | Returns the bitwise `OR` of `expr1` and `expr2`.                                                                                   |
| [- expr](https://docs.databricks.com/aws/en/sql/language-manual/functions/minussignunary.md)                                                           | Returns the negated value of `expr`.                                                                                               |
| [expr1 - expr2](https://docs.databricks.com/aws/en/sql/language-manual/functions/minussign.md)                                                         | Returns the subtraction of `expr2` from `expr1`.                                                                                   |
| [+ expr](https://docs.databricks.com/aws/en/sql/language-manual/functions/plussignunary.md)                                                            | Returns the value of `expr`.                                                                                                       |
| [expr1 + expr2](https://docs.databricks.com/aws/en/sql/language-manual/functions/plussign.md)                                                          | Returns the sum of `expr1` and `expr2`.                                                                                            |
| [dividend % divisor](https://docs.databricks.com/aws/en/sql/language-manual/functions/percentsign.md)                                                  | Returns the remainder after `dividend` / `divisor`.                                                                                |
| [expr1 ^ expr2](https://docs.databricks.com/aws/en/sql/language-manual/functions/caretsign.md)                                                         | Returns the bitwise exclusive `OR (XOR)` of `expr1` and `expr2`.                                                                   |
| [expr1 & expr2](https://docs.databricks.com/aws/en/sql/language-manual/functions/ampersandsign.md)                                                     | Returns the bitwise `AND` of `expr1` and `expr2`.                                                                                  |
| [multiplier \* multiplicand](https://docs.databricks.com/aws/en/sql/language-manual/functions/asterisksign.md)                                         | Returns `multiplier` multiplied by `multiplicand`.                                                                                 |
| [abs(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/abs.md)                                                                   | Returns the absolute value of the numeric value in `expr`.                                                                         |
| [acos(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/acos.md)                                                                 | Returns the inverse cosine (arccosine) of `expr`.                                                                                  |
| [acosh(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/acosh.md)                                                               | Returns the inverse hyperbolic cosine of `expr`.                                                                                   |
| [asin(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/asin.md)                                                                 | Returns the inverse sine (arcsine) of `expr`.                                                                                      |
| [asinh(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/asinh.md)                                                               | Returns the inverse hyperbolic sine of `expr`.                                                                                     |
| [atan(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/atan.md)                                                                 | Returns the inverse tangent (arctangent) of `expr`.                                                                                |
| [atan2(exprY, exprX)](https://docs.databricks.com/aws/en/sql/language-manual/functions/atan2.md)                                                       | Returns the angle in radians between the positive x-axis of a plane and the point specified by the coordinates (`exprX`, `exprY`). |
| [atanh(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/atanh.md)                                                               | Returns inverse hyperbolic tangent of `expr`.                                                                                      |
| [bigint(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/bigint.md)                                                             | Casts the value `expr` to `BIGINT`.                                                                                                |
| [bit\_count(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/bit_count.md)                                                      | Returns the number of bits set in the argument.                                                                                    |
| [bit\_get(expr, pos)](https://docs.databricks.com/aws/en/sql/language-manual/functions/bit_get.md)                                                     | Returns the value of a bit in a binary representation of an integral numeric.                                                      |
| [bit\_reverse(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/bit_reverse.md)                                                  | Returns the value obtained by reversing the order of the bits in the argument.                                                     |
| [bitmap\_bit\_position(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/bitmap_bit_position.md)                                 | Returns the 0-based bit position of a given `BIGINT` number within a bucket.                                                       |
| [bitmap\_bucket\_number(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/bitmap_bucket_number.md)                               | Returns the bitmap bucket number for a given `BIGINT` number.                                                                      |
| [bround(expr\[,targetScale\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/bround.md)                                             | Returns the rounded `expr` using `HALF_EVEN` rounding mode.                                                                        |
| [cbrt(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/cbrt.md)                                                                 | Returns the cube root of `expr`.                                                                                                   |
| [ceil(expr\[,targetScale\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/ceil.md)                                                 | Returns the smallest number not smaller than `expr` rounded up to `targetScale` digits relative to the decimal point.              |
| [ceiling(expr\[,targetScale\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/ceiling.md)                                           | Returns the smallest number not smaller than `expr` rounded up to `targetScale` digits relative to the decimal point.              |
| [conv(num, fromBase, toBase)](https://docs.databricks.com/aws/en/sql/language-manual/functions/conv.md)                                                | Converts `num` from `fromBase` to `toBase`.                                                                                        |
| [convert\_timezone(\[sourceTz, \]targetTz, sourceTs)](https://docs.databricks.com/aws/en/sql/language-manual/functions/convert_timezone.md)            | Converts the `TIMESTAMP_NTZ` `sourceTs` from the `sourceTz` time zone to `targetTz`.                                               |
| [cos(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/cos.md)                                                                   | Returns the cosine of `expr`.                                                                                                      |
| [cosh(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/cosh.md)                                                                 | Returns the hyperbolic cosine of `expr`.                                                                                           |
| [cot(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/cot.md)                                                                   | Returns the cotangent of `expr`.                                                                                                   |
| [csc(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/csc.md)                                                                   | Returns the cosecant of `expr`.                                                                                                    |
| [decimal(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/decimal.md)                                                           | Casts the value `expr` to `DECIMAL`.                                                                                               |
| [degrees(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/degrees.md)                                                           | Converts radians to degrees.                                                                                                       |
| [divisor div dividend](https://docs.databricks.com/aws/en/sql/language-manual/functions/div.md)                                                        | Returns the integral part of the division of `divisor` by `dividend`.                                                              |
| [double(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/double.md)                                                             | Casts the value `expr` to `DOUBLE`.                                                                                                |
| [e()](https://docs.databricks.com/aws/en/sql/language-manual/functions/e.md)                                                                           | Returns the constant `e`.                                                                                                          |
| [exp(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/exp.md)                                                                   | Returns `e` to the power of `expr`.                                                                                                |
| [expm1(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/expm1.md)                                                               | Returns `exp(expr) - 1`.                                                                                                           |
| [factorial(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/factorial.md)                                                       | Returns the factorial of `expr`.                                                                                                   |
| [float(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/float.md)                                                               | Casts the value `expr` to `FLOAT`.                                                                                                 |
| [floor(expr\[,targetScale\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/floor.md)                                               | Returns the largest number not smaller than `expr` rounded down to `targetScale` digits relative to the decimal point.             |
| [getbit(expr, pos)](https://docs.databricks.com/aws/en/sql/language-manual/functions/getbit.md)                                                        | Returns the value of a bit in a binary representation of an integral numeric.                                                      |
| [hypot(expr1, expr2)](https://docs.databricks.com/aws/en/sql/language-manual/functions/hypot.md)                                                       | Returns `sqrt(expr1 * expr1 + expr2 * expr2)`.                                                                                     |
| [int(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/int.md)                                                                   | Casts the value `expr` to `INTEGER`.                                                                                               |
| [isnan(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/isnan.md)                                                               | Returns `true` if `expr` is `NaN`.                                                                                                 |
| [kll\_sketch\_get\_n\_bigint(sketch)](https://docs.databricks.com/aws/en/sql/language-manual/functions/kll_sketch_get_n_bigint.md)                     | Returns the number of items in an integer KLL sketch.                                                                              |
| [kll\_sketch\_get\_n\_double(sketch)](https://docs.databricks.com/aws/en/sql/language-manual/functions/kll_sketch_get_n_double.md)                     | Returns the number of items in a double KLL sketch.                                                                                |
| [kll\_sketch\_get\_n\_float(sketch)](https://docs.databricks.com/aws/en/sql/language-manual/functions/kll_sketch_get_n_float.md)                       | Returns the number of items in a float KLL sketch.                                                                                 |
| [kll\_sketch\_get\_quantile\_bigint(sketch, rank)](https://docs.databricks.com/aws/en/sql/language-manual/functions/kll_sketch_get_quantile_bigint.md) | Estimates the value at a given quantile rank from an integer KLL sketch.                                                           |
| [kll\_sketch\_get\_quantile\_double(sketch, rank)](https://docs.databricks.com/aws/en/sql/language-manual/functions/kll_sketch_get_quantile_double.md) | Estimates the value at a given quantile rank from a double KLL sketch.                                                             |
| [kll\_sketch\_get\_quantile\_float(sketch, rank)](https://docs.databricks.com/aws/en/sql/language-manual/functions/kll_sketch_get_quantile_float.md)   | Estimates the value at a given quantile rank from a float KLL sketch.                                                              |
| [kll\_sketch\_get\_rank\_bigint(sketch, value)](https://docs.databricks.com/aws/en/sql/language-manual/functions/kll_sketch_get_rank_bigint.md)        | Estimates the normalized rank of a value in an integer KLL sketch.                                                                 |
| [kll\_sketch\_get\_rank\_double(sketch, value)](https://docs.databricks.com/aws/en/sql/language-manual/functions/kll_sketch_get_rank_double.md)        | Estimates the normalized rank of a value in a double KLL sketch.                                                                   |
| [kll\_sketch\_get\_rank\_float(sketch, value)](https://docs.databricks.com/aws/en/sql/language-manual/functions/kll_sketch_get_rank_float.md)          | Estimates the normalized rank of a value in a float KLL sketch.                                                                    |
| [kll\_sketch\_merge\_bigint(sketch1, sketch2)](https://docs.databricks.com/aws/en/sql/language-manual/functions/kll_sketch_merge_bigint.md)            | Merges two compatible integer KLL sketches.                                                                                        |
| [kll\_sketch\_merge\_double(sketch1, sketch2)](https://docs.databricks.com/aws/en/sql/language-manual/functions/kll_sketch_merge_double.md)            | Merges two compatible double KLL sketches.                                                                                         |
| [kll\_sketch\_merge\_float(sketch1, sketch2)](https://docs.databricks.com/aws/en/sql/language-manual/functions/kll_sketch_merge_float.md)              | Merges two compatible float KLL sketches.                                                                                          |
| [kll\_sketch\_to\_string\_bigint(sketch)](https://docs.databricks.com/aws/en/sql/language-manual/functions/kll_sketch_to_string_bigint.md)             | Returns a human-readable string representation of an integer KLL sketch.                                                           |
| [kll\_sketch\_to\_string\_double(sketch)](https://docs.databricks.com/aws/en/sql/language-manual/functions/kll_sketch_to_string_double.md)             | Returns a human-readable string representation of a double KLL sketch.                                                             |
| [kll\_sketch\_to\_string\_float(sketch)](https://docs.databricks.com/aws/en/sql/language-manual/functions/kll_sketch_to_string_float.md)               | Returns a human-readable string representation of a float KLL sketch.                                                              |
| [ln(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/ln.md)                                                                     | Returns the natural logarithm (base `e`) of `expr`.                                                                                |
| [log(\[base,\] expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/log.md)                                                         | Returns the logarithm of `expr` with `base`.                                                                                       |
| [log1p(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/log1p.md)                                                               | Returns `log(1 + expr)`.                                                                                                           |
| [log2(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/log2.md)                                                                 | Returns the logarithm of `expr` with base `2`.                                                                                     |
| [log10(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/log10.md)                                                               | Returns the logarithm of `expr` with base `10`.                                                                                    |
| [mod(dividend, divisor)](https://docs.databricks.com/aws/en/sql/language-manual/functions/mod.md)                                                      | Returns the remainder after `dividend / divisor`.                                                                                  |
| [nanvl(expr1, expr2)](https://docs.databricks.com/aws/en/sql/language-manual/functions/nanvl.md)                                                       | Returns `expr1` if it's not `NaN`, or `expr2` otherwise.                                                                           |
| [negative(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/negative.md)                                                         | Returns the negated value of `expr`.                                                                                               |
| '[nullifzero(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/nullifzero.md)'                                                   | Returns `expr` if it is not zero, or `NULL` otherwise.                                                                             |
| [pi()](https://docs.databricks.com/aws/en/sql/language-manual/functions/pi.md)                                                                         | Returns pi.                                                                                                                        |
| [pmod(dividend, divisor)](https://docs.databricks.com/aws/en/sql/language-manual/functions/pmod.md)                                                    | Returns the positive remainder after `dividend / divisor`.                                                                         |
| [positive(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/positive.md)                                                         | Returns the value of `expr`.                                                                                                       |
| [pow(expr1, expr2)](https://docs.databricks.com/aws/en/sql/language-manual/functions/pow.md)                                                           | Raises `expr1` to the power of `expr2`.                                                                                            |
| [power(expr1, expr2)](https://docs.databricks.com/aws/en/sql/language-manual/functions/power.md)                                                       | Raises `expr1` to the power of `expr2`.                                                                                            |
| [radians(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/radians.md)                                                           | Converts `expr` in degrees to radians.                                                                                             |
| [rand(\[seed\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/rand.md)                                                             | Returns a random value between 0 and 1.                                                                                            |
| [randn(\[seed\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/randn.md)                                                           | Returns a random value from a standard normal distribution.                                                                        |
| [random(\[seed\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/random.md)                                                         | Returns a random value between 0 and 1.                                                                                            |
| [rint(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/rint.md)                                                                 | Returns `expr` rounded to a whole number as a `DOUBLE`.                                                                            |
| [round(expr\[,targetScale\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/round.md)                                               | Returns the rounded `expr` using `HALF_UP` rounding mode.                                                                          |
| [sec(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/sec.md)                                                                   | Returns the secant of `expr`.                                                                                                      |
| [expr \<\< n](https://docs.databricks.com/aws/en/sql/language-manual/functions/ltltsign.md)                                                            | Returns `expr` bitwise left shifted by `n` bits.                                                                                   |
| [expr >> n](https://docs.databricks.com/aws/en/sql/language-manual/functions/gtgtsign.md)                                                              | Returns `expr` bitwise signed right shifted by `n` bits.                                                                           |
| [expr >>> n](https://docs.databricks.com/aws/en/sql/language-manual/functions/gtgtgtsign.md)                                                           | Returns `expr` bitwise unsigned right shifted by `n` bits.                                                                         |
| [shiftleft(expr, n)](https://docs.databricks.com/aws/en/sql/language-manual/functions/shiftleft.md)                                                    | Returns `expr` bitwise left shifted by `n` bits.                                                                                   |
| [shiftright(expr, n)](https://docs.databricks.com/aws/en/sql/language-manual/functions/shiftright.md)                                                  | Returns `expr` bitwise signed right shifted by `n` bits.                                                                           |
| [shiftrightunsigned(expr, n)](https://docs.databricks.com/aws/en/sql/language-manual/functions/shiftrightunsigned.md)                                  | Returns `expr` bitwise unsigned right shifted by `n` bits.                                                                         |
| [sign(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/sign.md)                                                                 | Returns -1.0, 0.0, or 1.0 as `expr` is negative, 0, or positive.                                                                   |
| [signum(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/signum.md)                                                             | Returns -1.0, 0.0, or 1.0 as `expr` is negative, 0, or positive.                                                                   |
| [sin(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/sin.md)                                                                   | Returns the sine of `expr`.                                                                                                        |
| [sinh(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/sinh.md)                                                                 | Returns the hyperbolic sine of `expr`.                                                                                             |
| [smallint(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/smallint.md)                                                         | Casts the value `expr` to `SMALLINT`.                                                                                              |
| [sqrt(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/sqrt.md)                                                                 | Returns the square root of `expr`.                                                                                                 |
| [tan(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/tan.md)                                                                   | Returns the tangent of `expr`.                                                                                                     |
| [tanh(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/tanh.md)                                                                 | Returns the hyperbolic tangent of `expr`.                                                                                          |
| [tinyint(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/tinyint.md)                                                           | Casts `expr` to `TINYINT`.                                                                                                         |
| [to\_number(expr, fmt )](https://docs.databricks.com/aws/en/sql/language-manual/functions/to_number.md)                                                | Returns `expr` cast to `DECIMAL` using formatting `fmt`.                                                                           |
| [try\_add(expr1, expr2)](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_add.md)                                                  | Returns the sum of `expr1` and `expr2`, or `NULL` in case of error.                                                                |
| [try\_divide(dividend, divisor)](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_divide.md)                                       | Returns `dividend` divided by `divisor`, or `NULL` if `divisor` is 0.                                                              |
| [try\_mod(dividend, divisor)](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_mod.md)                                             | Returns the remainder after `dividend / divisor`, or `NULL` if `divisor` is 0..                                                    |
| [try\_multiply(multiplier, multiplicand)](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_multiply.md)                            | Returns `multiplier` multiplied by `multiplicand`, or `NULL` on overflow.                                                          |
| [try\_subtract(expr1, expr2)](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_subtract.md)                                        | Returns the subtraction of `expr2` from `expr1`, or `NULL` on overflow.                                                            |
| [try\_to\_number(expr, fmt )](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_to_number.md)                                       | Returns `expr` cast to `DECIMAL` using formatting `fmt`, or `NULL` if `expr` does not match the format.                            |
| [uniform(expr1, expr2 \[,seed\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/uniform.md)                                         | Returns a random value with independent and identically distributed values within the specified range of numbers.                  |
| [width\_bucket(expr, minExpr, maxExpr, numBuckets)](https://docs.databricks.com/aws/en/sql/language-manual/functions/width_bucket.md)                  | Returns the bucket number for a value in an equi-width histogram.                                                                  |
| '[zeroifnull(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/zeroifnull.md)'                                                   | Returns `expr` if it is not `NULL`, or `0` otherwise.                                                                              |

## <a id="aggregate-functions" />Aggregate functions

| Function                                                                                                                                                                 | Description                                                                                                                                             |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [agg(measure\_column)](https://docs.databricks.com/aws/en/sql/language-manual/functions/agg.md)                                                                          | Returns the measure of a metric view calculated from values of a group. Synonym for `measure`.                                                          |
| [any(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/any.md)                                                                                     | Returns true if at least one value of `expr` in the group is true.                                                                                      |
| [any\_value(expr\[,ignoreNull\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/any_value.md)                                                         | Returns some value of `expr` for a group of rows.                                                                                                       |
| [approx\_count\_distinct(expr\[,relativeSD\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/approx_count_distinct.md)                                | Returns the estimated number of distinct values in `expr` within the group.                                                                             |
| [approx\_percentile(expr,percentage\[,accuracy\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/approx_percentile.md)                                | Returns the approximate percentile of the `expr` within the group.                                                                                      |
| [approx\_top\_k(expr\[,k\[,maxItemsTracked\]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/approx_top_k.md)                                       | Returns the top `k` most frequently occurring item values in an `expr` along with their approximate counts.                                             |
| [approx\_top\_k\_accumulate(expr \[, maxItemsTracked \])](https://docs.databricks.com/aws/en/sql/language-manual/functions/approx_top_k_accumulate.md)                   | Accumulates items into an ItemsSketch for approximate top-K estimation.                                                                                 |
| [approx\_top\_k\_combine(state \[, maxItemsTracked \])](https://docs.databricks.com/aws/en/sql/language-manual/functions/approx_top_k_combine.md)                        | Combines multiple approx\_top\_k sketch states into a single merged sketch.                                                                             |
| [array\_agg(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/array_agg.md)                                                                        | Returns an array consisting of all values in `expr` within the group.                                                                                   |
| [avg(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/avg.md)                                                                                     | Returns the mean calculated from values of a group.                                                                                                     |
| [bit\_and(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/bit_and.md)                                                                            | Returns the bitwise `AND` of all input values in the group.                                                                                             |
| [bit\_or(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/bit_or.md)                                                                              | Returns the bitwise `OR` of all input values in the group.                                                                                              |
| [bit\_xor(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/bit_xor.md)                                                                            | Returns the bitwise `XOR` of all input values in the group.                                                                                             |
| [bitmap\_and\_agg(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/bitmap_and_agg.md)                                                             | Returns the bitwise `AND` of all `BINARY` input values in the group.                                                                                    |
| [bitmap\_construct\_agg(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/bitmap_construct_agg.md)                                                 | Returns the bitwise `OR` of all bit position values in the group. between 0 and 32767 in a group as a `BINARY`.                                         |
| [bitmap\_or\_agg(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/bitmap_or_agg.md)                                                               | Returns the bitwise `OR` of all `BINARY` input values in the group.                                                                                     |
| [bool\_and(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/bool_and.md)                                                                          | Returns true if all values in `expr` are true within the group.                                                                                         |
| [bool\_or(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/bool_or.md)                                                                            | Returns true if at least one value in `expr` is true within the group.                                                                                  |
| [collect\_list(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/collect_list.md)                                                                  | Returns an array consisting of all values in `expr` within the group.                                                                                   |
| [collect\_set(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/collect_set.md)                                                                    | Returns an array consisting of all unique values in `expr` within the group.                                                                            |
| [corr(expr1,expr2)](https://docs.databricks.com/aws/en/sql/language-manual/functions/corr.md)                                                                            | Returns Pearson coefficient of correlation between a group of number pairs.                                                                             |
| [count(\*)](https://docs.databricks.com/aws/en/sql/language-manual/functions/count.md)                                                                                   | Returns the total number of retrieved rows in a group, including rows containing null.                                                                  |
| [count(expr\[, …\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/count.md)                                                                          | Returns the number of rows in a group for which the supplied expressions are all non-null.                                                              |
| [count\_if(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/count_if.md)                                                                          | Returns the number of true values for the group in `expr`.                                                                                              |
| [count\_min\_sketch(column,epsilon,confidence,seed)](https://docs.databricks.com/aws/en/sql/language-manual/functions/count_min_sketch.md)                               | Returns a count-min sketch of all values in the group in `column` with the `epsilon`, `confidence` and `seed`.                                          |
| [covar\_pop(expr1,expr2)](https://docs.databricks.com/aws/en/sql/language-manual/functions/covar_pop.md)                                                                 | Returns the population covariance of number pairs in a group.                                                                                           |
| [covar\_samp(expr1,expr2)](https://docs.databricks.com/aws/en/sql/language-manual/functions/covar_samp.md)                                                               | Returns the sample covariance of number pairs in a group.                                                                                               |
| [every(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/every.md)                                                                                 | Returns true if all values of `expr` in the group are true.                                                                                             |
| [first(expr\[,ignoreNull\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/first.md)                                                                  | Returns the first value of `expr` for a group of rows.                                                                                                  |
| [first\_value(expr\[,ignoreNull\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/first_value.md)                                                     | Returns the first value of `expr` for a group of rows.                                                                                                  |
| [histogram\_numeric(expr,numBins)](https://docs.databricks.com/aws/en/sql/language-manual/functions/histogram_numeric.md)                                                | Computes a histogram on `expr` with `numBins` bins, returning an array of pairs representing the bin centers.                                           |
| [hll\_sketch\_agg(expr\[,lgConfigK\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/hll_sketch_agg.md)                                               | Returns a HyperLogLog sketch used to approximate a distinct values count.                                                                               |
| [hll\_union\_agg(expr\[,allowDifferentLgConfigK\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/hll_union_agg.md)                                   | Aggregates HyperLogLog sketches for a group of rows.                                                                                                    |
| [kll\_sketch\_agg\_bigint(expr\[, k\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/kll_sketch_agg_bigint.md)                                       | Returns a KLL sketch for approximating the distribution of integer values in a group.                                                                   |
| [kll\_sketch\_agg\_double(expr\[, k\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/kll_sketch_agg_double.md)                                       | Returns a KLL sketch for approximating the distribution of double values in a group.                                                                    |
| [kll\_sketch\_agg\_float(expr\[, k\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/kll_sketch_agg_float.md)                                         | Returns a KLL sketch for approximating the distribution of float values in a group.                                                                     |
| [kll\_merge\_agg\_bigint(sketch\[, k\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/kll_merge_agg_bigint.md)                                       | Merges multiple integer KLL sketch buffers into one result buffer.                                                                                      |
| [kll\_merge\_agg\_double(sketch\[, k\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/kll_merge_agg_double.md)                                       | Merges multiple double KLL sketch buffers into one result buffer.                                                                                       |
| [kll\_merge\_agg\_float(sketch\[, k\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/kll_merge_agg_float.md)                                         | Merges multiple float KLL sketch buffers into one result buffer.                                                                                        |
| [kurtosis(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/kurtosis.md)                                                                           | Returns the kurtosis value calculated from values of a group.                                                                                           |
| [last(expr\[,ignoreNull\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/last.md)                                                                    | Returns the last value of `expr` for the group of rows.                                                                                                 |
| [last\_value(expr\[,ignoreNull\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/last_value.md)                                                       | Returns the last value of `expr` for the group of rows.                                                                                                 |
| [listagg(expr\[,delim\]) \[WITHIN GROUP (ORDER BY key \[,...\])\]](https://docs.databricks.com/aws/en/sql/language-manual/functions/listagg.md)                          | Returns a concatenated `STRING` or `BINARY` of all values in `expr` within the group, separated by `delim`.                                             |
| [max(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/max.md)                                                                                     | Returns the maximum value of `expr` in a group.                                                                                                         |
| [max\_by(expr, ordExpr \[, limit \])](https://docs.databricks.com/aws/en/sql/language-manual/functions/max_by.md)                                                        | Returns the value of `expr` associated with the maximum value of `ordExpr` in a group; with optional `limit`, returns an array of up to `limit` values. |
| [mean(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/mean.md)                                                                                   | Returns the mean calculated from values of a group.                                                                                                     |
| [measure(measure\_column)](https://docs.databricks.com/aws/en/sql/language-manual/functions/measure.md)                                                                  | Returns the measure of a metric view calculated from values of a group.                                                                                 |
| [median(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/median.md)                                                                               | Returns the median calculated from values of a group.                                                                                                   |
| [min(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/min.md)                                                                                     | Returns the minimum value of `expr` in a group.                                                                                                         |
| [min\_by(expr, ordExpr \[, limit \])](https://docs.databricks.com/aws/en/sql/language-manual/functions/min_by.md)                                                        | Returns the value of `expr` associated with the minimum value of `ordExpr` in a group; with optional `limit`, returns an array of up to `limit` values. |
| [mode(expr \[,deterministic\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/mode.md)                                                                | Returns the most frequent, not `NULL`, value of `expr` in a group.                                                                                      |
| [percentile(expr, percentage \[,frequency\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/percentile.md)                                            | Returns the exact percentile value of `expr` at the specified `percentage`.                                                                             |
| [percentile\_approx(expr,percentage\[,accuracy\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/percentile_approx.md)                                | Returns the approximate percentile of the `expr` within the group.                                                                                      |
| [percentile\_cont(pct) WITHIN GROUP (ORDER BY key)](https://docs.databricks.com/aws/en/sql/language-manual/functions/percentile_cont.md)                                 | Returns the interpolated percentile of the `key` within the group.                                                                                      |
| [percentile\_disc(pct) WITHIN GROUP (ORDER BY key)](https://docs.databricks.com/aws/en/sql/language-manual/functions/percentile_disc.md)                                 | Returns the discrete percentile of the `key` within the group.                                                                                          |
| [regr\_avgx(yExpr, xExpr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/regr_avgx.md)                                                                | Returns the mean of `xExpr` calculated from values of a group where `xExpr` and `yExpr` are `NOT NULL`.                                                 |
| [regr\_avgy(yExpr, xExpr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/regr_avgy.md)                                                                | Returns the mean of `yExpr` calculated from values of a group where `xExpr` and `yExpr` are `NOT NULL`.                                                 |
| [regr\_count(yExpr, xExpr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/regr_count.md)                                                              | Returns the number of non-null value pairs `yExpr`, `xExpr` in the group.                                                                               |
| [regr\_intercept(yExpr, xExpr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/regr_intercept.md)                                                      | Returns the intercept of the uni-variate linear regression line in a group where `xExpr` and `yExpr` are NOT NULL.                                      |
| [regr\_r2(yExpr, xExpr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/regr_r2.md)                                                                    | Returns the coefficient of determination from values of a group where `xExpr` and `yExpr` are NOT NULL.                                                 |
| [regr\_slope(yExpr, xExpr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/regr_slope.md)                                                              | Returns the slope of the linear regression line of non-null value pairs `yExpr`, `xExpr` in the group.                                                  |
| [regr\_sxx(yExpr, xExpr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/regr_sxx.md)                                                                  | Returns the sum of squares of the `xExpr` values of a group where `xExpr` and `yExpr` are NOT NULL.                                                     |
| [regr\_sxy(yExpr, xExpr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/regr_sxy.md)                                                                  | Returns the sum of products of `yExpr` and `xExpr` calculated from values of a group where `xExpr` and `yExpr` are `NOT NULL`.                          |
| [regr\_syy(yExpr, xExpr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/regr_syy.md)                                                                  | Returns the sum of squares of the `yExpr` values of a group where `xExpr` and `yExpr` are NOT NULL.                                                     |
| [schema\_of\_json\_agg(json\[, options\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/schema_of_json_agg.md)                                       | Returns the combined schema of `JSON` strings in a group in DDL format.                                                                                 |
| [schema\_of\_variant\_agg(variantExpr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/schema_of_variant.md)                                           | Returns the combined schema of all `VARIANT` values in a group in DDL format.                                                                           |
| [skewness(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/skewness.md)                                                                           | Returns the skewness value calculated from values of a group.                                                                                           |
| [some(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/some.md)                                                                                   | Returns true if at least one value of `expr` in a group is `true`.                                                                                      |
| [std(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/std.md)                                                                                     | Returns the sample standard deviation calculated from the values within the group.                                                                      |
| [stddev(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/stddev.md)                                                                               | Returns the sample standard deviation calculated from the values within the group.                                                                      |
| [stddev\_pop(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/stddev_pop.md)                                                                      | Returns the population standard deviation calculated from values of a group.                                                                            |
| [stddev\_samp(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/stddev_samp.md)                                                                    | Returns the sample standard deviation calculated from values of a group.                                                                                |
| [string\_agg(expr\[,delim\]) \[WITHIN GROUP (ORDER BY key \[,...\])\]](https://docs.databricks.com/aws/en/sql/language-manual/functions/string_agg.md)                   | Returns a concatenated `STRING` or `BINARY` of all values in `expr` within the group, separated by `delim`.                                             |
| [sum(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/sum.md)                                                                                     | Returns the sum calculated from values of a group.                                                                                                      |
| [theta\_intersection\_agg(sketch)](https://docs.databricks.com/aws/en/sql/language-manual/functions/theta_intersection_agg.md)                                           | Intersects multiple Theta Sketch buffers into one result buffer.                                                                                        |
| [theta\_sketch\_agg(expr\[,lgNomEntries\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/theta_sketch_agg.md)                                        | Creates a Theta Sketch from input values for approximate distinct count estimation.                                                                     |
| [theta\_union\_agg(sketch\[,lgNomEntries\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/theta_union_agg.md)                                        | Merges multiple Theta Sketch buffers using set union into one result buffer.                                                                            |
| [try\_avg(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_avg.md)                                                                            | Returns the mean calculated from values of a group, `NULL` if there is an overflow.                                                                     |
| [try\_sum(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_sum.md)                                                                            | Returns the sum calculated from values of a group, `NULL` if there is an overflow.                                                                      |
| [tuple\_intersection\_agg\_double(sketch \[, mode \])](https://docs.databricks.com/aws/en/sql/language-manual/functions/tuple_intersection_agg_double.md)                | Computes the intersection of multiple TupleSketch binary representations with double summaries.                                                         |
| [tuple\_intersection\_agg\_integer(sketch \[, mode \])](https://docs.databricks.com/aws/en/sql/language-manual/functions/tuple_intersection_agg_integer.md)              | Computes the intersection of multiple TupleSketch binary representations with integer summaries.                                                        |
| [tuple\_sketch\_agg\_double(key, summary \[, lgNomEntries \[, mode \]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/tuple_sketch_agg_double.md)   | Creates a TupleSketch from key-value pairs with double summaries for distinct counting and aggregation.                                                 |
| [tuple\_sketch\_agg\_integer(key, summary \[, lgNomEntries \[, mode \]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/tuple_sketch_agg_integer.md) | Creates a TupleSketch from key-value pairs with integer summaries for distinct counting and aggregation.                                                |
| [tuple\_union\_agg\_double(sketch \[, lgNomEntries \[, mode \]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/tuple_union_agg_double.md)           | Unions multiple TupleSketch binary representations with double summaries into a single merged sketch.                                                   |
| [tuple\_union\_agg\_integer(sketch \[, lgNomEntries \[, mode \]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/tuple_union_agg_integer.md)         | Unions multiple TupleSketch binary representations with integer summaries into a single merged sketch.                                                  |
| [var\_pop(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/var_pop.md)                                                                            | Returns the population variance calculated from values of a group.                                                                                      |
| [var\_samp(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/var_samp.md)                                                                          | Returns the sample variance calculated from values of a group.                                                                                          |
| [variance(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/variance.md)                                                                           | Returns the sample variance calculated from values of a group.                                                                                          |
| [vector\_avg(vectors)](https://docs.databricks.com/aws/en/sql/language-manual/functions/vector_avg.md)                                                                   | Computes the element-wise average of `ARRAY<FLOAT>` vectors in a group.                                                                                 |
| [vector\_sum(vectors)](https://docs.databricks.com/aws/en/sql/language-manual/functions/vector_sum.md)                                                                   | Computes the element-wise sum of `ARRAY<FLOAT>` vectors in a group.                                                                                     |

## Ranking window functions

| Function                                                                                            | Description                                                                                                                        |
| --------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| [dense\_rank()](https://docs.databricks.com/aws/en/sql/language-manual/functions/dense_rank.md)     | Returns the rank of a value compared to all values in the partition.                                                               |
| [ntile(n)](https://docs.databricks.com/aws/en/sql/language-manual/functions/ntile.md)               | Divides the rows for each window partition into n buckets ranging from 1 to at most `n`.                                           |
| [percent\_rank()](https://docs.databricks.com/aws/en/sql/language-manual/functions/percent_rank.md) | Computes the percentage ranking of a value within the partition.                                                                   |
| [rank()](https://docs.databricks.com/aws/en/sql/language-manual/functions/rank.md)                  | Returns the rank of a value compared to all values in the partition.                                                               |
| [row\_number()](https://docs.databricks.com/aws/en/sql/language-manual/functions/row_number.md)     | Assigns a unique, sequential number to each row, starting with one, according to the ordering of rows within the window partition. |

## Analytic window functions

| Function                                                                                                                                    | Description                                                                          |
| ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ |
| [counter\_diff(value\[,start\_time\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/counter_diff.md)                    | Returns the difference between consecutive cumulative counter values in a partition. |
| [cume\_dist()](https://docs.databricks.com/aws/en/sql/language-manual/functions/cume_dist.md)                                               | Returns the position of a value relative to all values in the partition.             |
| [lag(expr\[,offset\[,default\]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/lag.md)                                 | Returns the value of `expr` from a preceding row within the partition.               |
| [lead(expr\[,offset\[,default\]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/lead.md)                               | Returns the value of `expr` from a subsequent row within the partition.              |
| [nth\_value(expr, offset) \[IGNORE NULLS \| RESPECT NULLS\]](https://docs.databricks.com/aws/en/sql/language-manual/functions/nth_value.md) | Returns the value of `expr` at a specific `offset` in the window.                    |

## Array functions

| Function                                                                                                                           | Description                                                                                        |
| ---------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| [arrayExpr\[indexExpr\]](https://docs.databricks.com/aws/en/sql/language-manual/functions/bracketsign.md)                          | Returns element at position `indexExpr` of ARRAY `arrayExpr`.                                      |
| [aggregate(expr,start,merge\[,finish\]) ](https://docs.databricks.com/aws/en/sql/language-manual/functions/aggregate.md)           | Aggregates elements in an array using a custom aggregator.                                         |
| [array(\[expr \[, …\]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/array.md)                               | Returns an array with the elements in `expr`.                                                      |
| [array\_append(array, elem)](https://docs.databricks.com/aws/en/sql/language-manual/functions/array_append.md)                     | Returns `array` appended by `elem`.                                                                |
| [array\_compact(array)](https://docs.databricks.com/aws/en/sql/language-manual/functions/array_compact.md)                         | Removes NULL values from `array`.                                                                  |
| [array\_contains(array,value)](https://docs.databricks.com/aws/en/sql/language-manual/functions/array_contains.md)                 | Returns true if `array` contains `value`.                                                          |
| [array\_distinct(array)](https://docs.databricks.com/aws/en/sql/language-manual/functions/array_distinct.md)                       | Removes duplicate values from `array`.                                                             |
| [array\_except(array1,array2)](https://docs.databricks.com/aws/en/sql/language-manual/functions/array_except.md)                   | Returns an array of the elements in `array1` but not in `array2`.                                  |
| [array\_insert(array, index, elem)](https://docs.databricks.com/aws/en/sql/language-manual/functions/array_insert.md)              | Returns an expanded `array` where `elem` is inserted at the `index` position.                      |
| [array\_intersect(array1,array2)](https://docs.databricks.com/aws/en/sql/language-manual/functions/array_intersect.md)             | Returns an array of the elements in the intersection of `array1` and `array2`.                     |
| [array\_join(array,delimiter\[,nullReplacement\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/array_join.md) | Concatenates the elements of `array`.                                                              |
| [array\_max(array)](https://docs.databricks.com/aws/en/sql/language-manual/functions/array_max.md)                                 | Returns the maximum value in `array`.                                                              |
| [array\_min(array)](https://docs.databricks.com/aws/en/sql/language-manual/functions/array_min.md)                                 | Returns the minimum value in `array`.                                                              |
| [array\_position(array,element)](https://docs.databricks.com/aws/en/sql/language-manual/functions/array_position.md)               | Returns the position of the first occurrence of `element` in `array`.                              |
| [array\_prepend(array, elem)](https://docs.databricks.com/aws/en/sql/language-manual/functions/array_prepend.md)                   | Returns `array` prepended by `elem`.                                                               |
| [array\_remove(array,element)](https://docs.databricks.com/aws/en/sql/language-manual/functions/array_remove.md)                   | Removes all occurrences of `element` from `array`.                                                 |
| [array\_repeat(element,count)](https://docs.databricks.com/aws/en/sql/language-manual/functions/array_repeat.md)                   | Returns an array containing `element` `count` times.                                               |
| [array\_size(array)](https://docs.databricks.com/aws/en/sql/language-manual/functions/array_size.md)                               | Returns the number of elements in `array`.                                                         |
| [array\_sort(array,func)](https://docs.databricks.com/aws/en/sql/language-manual/functions/array_sort.md)                          | Returns `array` sorted according to `func`.                                                        |
| [array\_union(array1,array2)](https://docs.databricks.com/aws/en/sql/language-manual/functions/array_union.md)                     | Returns an array of the elements in the union of `array1` and `array2` without duplicates.         |
| [arrays\_overlap(array1, array2)](https://docs.databricks.com/aws/en/sql/language-manual/functions/arrays_overlap.md)              | Returns true if the intersection of `array1` and `array2` is not empty.                            |
| [arrays\_zip(array1 \[, …\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/arrays_zip.md)                      | Returns a merged array of structs in which the nth struct contains all Nth values of input arrays. |
| [cardinality(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/cardinality.md)                               | Returns the size of `expr`.                                                                        |
| [concat(expr1, expr2 \[, …\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/concat.md)                         | Returns the concatenation of the arguments.                                                        |
| [element\_at(arrayExpr, index)](https://docs.databricks.com/aws/en/sql/language-manual/functions/element_at.md)                    | Returns the element of an `arrayExpr` at `index`.                                                  |
| [exists(expr, pred)](https://docs.databricks.com/aws/en/sql/language-manual/functions/exists.md)                                   | Returns true if `pred` is true for any element in `expr`.                                          |
| [explode(collection)](https://docs.databricks.com/aws/en/sql/language-manual/functions/explode.md)                                 | Returns rows by un-nesting `collection`.                                                           |
| [explode\_outer(collection)](https://docs.databricks.com/aws/en/sql/language-manual/functions/explode_outer.md)                    | Returns rows by un-nesting `collection` using outer semantics.                                     |
| [filter(expr,func)](https://docs.databricks.com/aws/en/sql/language-manual/functions/filter.md)                                    | Filters the array in `expr` using the function `func`.                                             |
| [flatten(arrayOfArrays)](https://docs.databricks.com/aws/en/sql/language-manual/functions/flatten.md)                              | Transforms an array of arrays into a single array.                                                 |
| [forall(expr, predFunc)](https://docs.databricks.com/aws/en/sql/language-manual/functions/forall.md)                               | Tests whether `predFunc` holds for all elements in the array.                                      |
| [get(arrayExpr, index)](https://docs.databricks.com/aws/en/sql/language-manual/functions/get.md)                                   | Returns the element of an `arrayExpr` at `index`, starting at `0`.                                 |
| [inline(input)](https://docs.databricks.com/aws/en/sql/language-manual/functions/inline.md)                                        | Explodes an array of structs into a table.                                                         |
| [inline\_outer(input)](https://docs.databricks.com/aws/en/sql/language-manual/functions/inline_outer.md)                           | Explodes an array of structs into a table with outer semantics.                                    |
| [posexplode(collection)](https://docs.databricks.com/aws/en/sql/language-manual/functions/posexplode.md)                           | Returns rows by un-nesting the array with numbering of positions.                                  |
| [posexplode\_outer(collection)](https://docs.databricks.com/aws/en/sql/language-manual/functions/posexplode_outer.md)              | Returns rows by un-nesting the array with numbering of positions using `OUTER` semantics.          |
| [reduce(expr,start,merge\[,finish\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/reduce.md)                  | Aggregates elements in an array using a custom aggregator.                                         |
| [reverse(array)](https://docs.databricks.com/aws/en/sql/language-manual/functions/reverse.md)                                      | Returns a reversed string or an array with reverse order of elements.                              |
| [sequence(start,stop,step)](https://docs.databricks.com/aws/en/sql/language-manual/functions/sequence.md)                          | Generates an array of elements from `start` to `stop` (inclusive), incrementing by `step`.         |
| [shuffle(array)](https://docs.databricks.com/aws/en/sql/language-manual/functions/shuffle.md)                                      | Returns a random permutation of the array in `expr`.                                               |
| [size(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/cardinality.md)                                      | Returns the cardinality of `expr`.                                                                 |
| [slice(expr,start,length)](https://docs.databricks.com/aws/en/sql/language-manual/functions/slice.md)                              | Returns a subset of an array.                                                                      |
| [sort\_array(expr\[,ascendingOrder\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/sort_array.md)             | Returns the array in `expr` in sorted order.                                                       |
| [transform(expr, func)](https://docs.databricks.com/aws/en/sql/language-manual/functions/transform.md)                             | Transforms elements in an array in `expr` using the function `func`.                               |
| [try\_element\_at(arrayExpr, index)](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_element_at.md)           | Returns the element of an `arrayExpr` at `index`, or `NULL` if `index` is out of bound.            |
| [zip\_with(expr1, expr2, func)](https://docs.databricks.com/aws/en/sql/language-manual/functions/zip_with.md)                      | Merges the arrays in `expr1` and `expr2`, element-wise, into a single array using `func`.          |

## Map functions

| Function                                                                                                                             | Description                                                                  |
| ------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------- |
| [mapExpr\[keyExpr\]](https://docs.databricks.com/aws/en/sql/language-manual/functions/bracketsign.md)                                | Returns value at `keyExpr` of MAP `mapExpr`.                                 |
| [cardinality(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/cardinality.md)                                 | Returns the size of `expr`.                                                  |
| [element\_at(mapExpr, key)](https://docs.databricks.com/aws/en/sql/language-manual/functions/element_at.md)                          | Returns the value of `mapExpr` for `key`.                                    |
| [explode(collection)](https://docs.databricks.com/aws/en/sql/language-manual/functions/explode.md)                                   | Returns rows by un-nesting `expr`.                                           |
| [explode\_outer(collection)](https://docs.databricks.com/aws/en/sql/language-manual/functions/explode_outer.md)                      | Returns rows by un-nesting `expr` using outer semantics.                     |
| [map(\[\{key1, value1}\[, …\]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/map.md)                           | Creates a map with the specified key-value pairs.                            |
| [map\_concat(\[expr1 \[, …\]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/map_concat.md)                     | Returns the union of all `expr` map expressions.                             |
| [map\_contains\_key(map, key)](https://docs.databricks.com/aws/en/sql/language-manual/functions/map_contains_key.md)                 | Returns `true` if `map` contains `key`, `false` otherwise.                   |
| [map\_entries(map)](https://docs.databricks.com/aws/en/sql/language-manual/functions/map_entries.md)                                 | Returns an unordered array of all entries in `map`.                          |
| [map\_filter(expr, func)](https://docs.databricks.com/aws/en/sql/language-manual/functions/map_filter.md)                            | Filters entries in the map in `expr` using the function `func`.              |
| [map\_from\_arrays(keys, values)](https://docs.databricks.com/aws/en/sql/language-manual/functions/map_from_arrays.md)               | Creates a map with a pair of the `keys` and `values` arrays.                 |
| [map\_from\_entries(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/map_from_entries.md)                     | Creates a map created from the specified array of entries.                   |
| [map\_keys(map)](https://docs.databricks.com/aws/en/sql/language-manual/functions/map_keys.md)                                       | Returns an unordered array containing the keys of `map`.                     |
| [map\_values(map)](https://docs.databricks.com/aws/en/sql/language-manual/functions/map_values.md)                                   | Returns an unordered array containing the values of `map`.                   |
| [map\_zip\_with(map1, map2, func)](https://docs.databricks.com/aws/en/sql/language-manual/functions/map_zip_with.md)                 | Merges `map1` and `map2` into a single map.                                  |
| [size(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/cardinality.md)                                        | Returns the cardinality of `expr`.                                           |
| [str\_to\_map(expr\[,pairDelim\[,keyValueDelim\]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/str_to_map.md) | Returns a map after splitting `expr` into key-value pairs using delimiters.  |
| [transform\_keys(expr, func)](https://docs.databricks.com/aws/en/sql/language-manual/functions/transform_keys.md)                    | Transforms keys in a map in `expr` using the function `func`.                |
| [transform\_values(expr, func)](https://docs.databricks.com/aws/en/sql/language-manual/functions/transform_values.md)                | Transforms values in a map in `expr` using the function `func`.              |
| [try\_element\_at(mapExpr, key)](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_element_at.md)                 | Returns the value of `mapExpr` for `key`, or `NULL` if `key` does not exist. |

## Date, timestamp, and interval functions

For information on date and timestamp formats, see [Datetime patterns](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-datetime-pattern.md).

| Function                                                                                                                                                                      | Description                                                                                                                                                                                                                                                                 |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [intervalExpr / divisor](https://docs.databricks.com/aws/en/sql/language-manual/functions/slashsign.md)                                                                       | Returns interval divided by `divisor`.                                                                                                                                                                                                                                      |
| [- intervalExpr](https://docs.databricks.com/aws/en/sql/language-manual/functions/minussignunary.md)                                                                          | Returns the negated value of `intervalExpr`.                                                                                                                                                                                                                                |
| [intervalExpr1 - intervalExpr2](https://docs.databricks.com/aws/en/sql/language-manual/functions/minussign.md)                                                                | Returns the subtraction of `intervalExpr2` from `intervalExpr1`.                                                                                                                                                                                                            |
| [datetimeExpr1 - datetimeExpr2](https://docs.databricks.com/aws/en/sql/language-manual/functions/minussign.md)                                                                | Returns the subtraction of `datetimeExpr2` from `datetimeExpr1`.                                                                                                                                                                                                            |
| [+ intervalExpr](https://docs.databricks.com/aws/en/sql/language-manual/functions/plussignunary.md)                                                                           | Returns the value of `intervalExpr`.                                                                                                                                                                                                                                        |
| [intervalExpr1 + intervalExpr2](https://docs.databricks.com/aws/en/sql/language-manual/functions/plussign.md)                                                                 | Returns the sum of `intervalExpr1` and `intervalExpr2`.                                                                                                                                                                                                                     |
| [intervalExpr \* multiplicand](https://docs.databricks.com/aws/en/sql/language-manual/functions/asterisksign.md)                                                              | Returns `intervalExpr` multiplied by `multiplicand`.                                                                                                                                                                                                                        |
| [abs(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/abs.md)                                                                                          | Returns the absolute value of the interval value in `expr`.                                                                                                                                                                                                                 |
| [add\_months(startDate,numMonths)](https://docs.databricks.com/aws/en/sql/language-manual/functions/add_months.md)                                                            | Returns the date that is `numMonths` after `startDate`.                                                                                                                                                                                                                     |
| [curdate()](https://docs.databricks.com/aws/en/sql/language-manual/functions/curdate.md)                                                                                      | Returns the current date at the start of query evaluation.                                                                                                                                                                                                                  |
| [current\_date()](https://docs.databricks.com/aws/en/sql/language-manual/functions/current_date.md)                                                                           | Returns the current date at the start of query evaluation.                                                                                                                                                                                                                  |
| [current\_time(\[precision\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/current_time.md)                                                              | Returns the current time at the start of query evaluation.                                                                                                                                                                                                                  |
| [current\_timestamp(\[precision\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/current_timestamp.md)                                                    | Returns the current timestamp at the start of query evaluation.                                                                                                                                                                                                             |
| [current\_timezone()](https://docs.databricks.com/aws/en/sql/language-manual/functions/current_timezone.md)                                                                   | Returns the current session local timezone.                                                                                                                                                                                                                                 |
| [date(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/date.md)                                                                                        | Casts the value `expr` to `DATE`.                                                                                                                                                                                                                                           |
| [date\_add(startDate,numDays)](https://docs.databricks.com/aws/en/sql/language-manual/functions/date_add.md)                                                                  | Returns the date `numDays` after `startDate`.                                                                                                                                                                                                                               |
| [date\_add(unit, value, expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/date_add3.md)                                                                 | Adds `value` `unit`s to a timestamp `expr`.                                                                                                                                                                                                                                 |
| [date\_diff(endDate, startDate)](https://docs.databricks.com/aws/en/sql/language-manual/functions/date_diff.md)                                                               | Returns the number of days from `startDate` to `endDate`.                                                                                                                                                                                                                   |
| [date\_diff(unit, start, stop)](https://docs.databricks.com/aws/en/sql/language-manual/functions/date_diff.md)                                                                | Returns the difference between two timestamps measured in `unit`s.                                                                                                                                                                                                          |
| [date\_format(expr,fmt)](https://docs.databricks.com/aws/en/sql/language-manual/functions/date_format.md)                                                                     | Converts a date, time, or timestamp to a string in the format `fmt`.                                                                                                                                                                                                        |
| [date\_from\_unix\_date(days)](https://docs.databricks.com/aws/en/sql/language-manual/functions/date_from_unix_date.md)                                                       | Creates a date from the number of days since `1970-01-01`.                                                                                                                                                                                                                  |
| [date\_part(field,expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/date_part.md)                                                                       | Extracts a part of the date, time, timestamp, or interval.                                                                                                                                                                                                                  |
| [datepart(field,expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/date_part.md)                                                                         | An alias for `date_part`.                                                                                                                                                                                                                                                   |
| [date\_sub(startDate,numDays)](https://docs.databricks.com/aws/en/sql/language-manual/functions/date_sub.md)                                                                  | Returns the date `numDays` before `startDate`.                                                                                                                                                                                                                              |
| [date\_trunc(unit,expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/date_trunc.md)                                                                      | Returns timestamp truncated to the unit specified in `unit`.                                                                                                                                                                                                                |
| [dateadd(startDate,numDays)](https://docs.databricks.com/aws/en/sql/language-manual/functions/dateadd2.md)                                                                    | Returns the date `numDays` after `startDate`.                                                                                                                                                                                                                               |
| [dateadd(unit, value, expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/dateadd.md)                                                                     | Adds `value` `unit`s to a timestamp `expr`.                                                                                                                                                                                                                                 |
| [datediff(endDate,startDate)](https://docs.databricks.com/aws/en/sql/language-manual/functions/datediff.md)                                                                   | Returns the number of days from `startDate` to `endDate`.                                                                                                                                                                                                                   |
| [datediff(unit, start, stop)](https://docs.databricks.com/aws/en/sql/language-manual/functions/datediff3.md)                                                                  | Returns the difference between two timestamps measured in `unit`s.                                                                                                                                                                                                          |
| [day(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/day.md)                                                                                          | Returns the day of month of the date or timestamp.                                                                                                                                                                                                                          |
| [dayname(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/dayname.md)                                                                                  | Returns the three-letter english acronym for the day of the week for the given date.                                                                                                                                                                                        |
| [dayofmonth(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/dayofmonth.md)                                                                            | Returns the day of month of the date or timestamp.                                                                                                                                                                                                                          |
| [dayofweek(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/dayofweek.md)                                                                              | Returns the day of week of the date or timestamp.                                                                                                                                                                                                                           |
| [dayofyear(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/dayofyear.md)                                                                              | Returns the day of year of the date or timestamp.                                                                                                                                                                                                                           |
| [divisor div dividend](https://docs.databricks.com/aws/en/sql/language-manual/functions/div.md)                                                                               | Returns the integral part of the division of interval `divisor` by interval `dividend`.                                                                                                                                                                                     |
| [extract(field FROM source)](https://docs.databricks.com/aws/en/sql/language-manual/functions/extract.md)                                                                     | Returns `field` of `source`.                                                                                                                                                                                                                                                |
| [from\_unixtime(unixTime \[, fmt\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/from_unixtime.md)                                                       | Returns `unixTime` in `fmt`.                                                                                                                                                                                                                                                |
| [from\_utc\_timestamp(expr,timezone)](https://docs.databricks.com/aws/en/sql/language-manual/functions/from_utc_timestamp.md)                                                 | Returns the timestamp at `UTC` for a timestamp `expr` at `timeZone`.                                                                                                                                                                                                        |
| [getdate(\[precision\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/getdate.md)                                                                         | Returns the current timestamp at the start of query evaluation.                                                                                                                                                                                                             |
| [hour(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/hour.md)                                                                                        | Returns the hour component of a timestamp.                                                                                                                                                                                                                                  |
| [last\_day(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/last_day.md)                                                                               | Returns the last day of the month that the date belongs to.                                                                                                                                                                                                                 |
| [localtime(\[precision\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/localtime.md)                                                                     | Returns the current time at the start of query evaluation.                                                                                                                                                                                                                  |
| [localtimestamp(\[precision\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/localtimestamp.md)                                                           | Returns the current timestamp without a time zone at the start of query evaluation.                                                                                                                                                                                         |
| [make\_date(year,month,day)](https://docs.databricks.com/aws/en/sql/language-manual/functions/make_date.md)                                                                   | Creates a date from `year`, `month`, and `day` fields.                                                                                                                                                                                                                      |
| [make\_dt\_interval(\[days\[, hours\[, mins\[, secs\]\]\]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/make_dt_interval.md)                           | Creates an day-time interval from `days`, `hours`, `mins` and `secs`.                                                                                                                                                                                                       |
| [make\_interval(\[years\[,months\[,weeks\[,days\[,hours\[,mins\[,secs\]\]\]\]\]\]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/make_interval.md)      | Deprecated: Creates an interval from `years`, `months`, `weeks`, `days`, `hours`, `mins` and `secs`.                                                                                                                                                                        |
| [make\_time(hour, minute, second)](https://docs.databricks.com/aws/en/sql/language-manual/functions/make_time.md)                                                             | Creates a time from `hour`, `minute`, and `second` fields.                                                                                                                                                                                                                  |
| [make\_timestamp(year,month,day,hour,min,sec\[,timezone\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/make_timestamp.md)                               | Creates a timestamp from `year`, `month`, `day`, `hour`, `min`, `sec`, and `timezone` fields.                                                                                                                                                                               |
| [make\_timestamp\_ltz(year,month,day,hour,min,sec\[,timezone\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/make_timestamp_ltz.md)                      | Creates a timestamp with a local time zone from date and time fields.                                                                                                                                                                                                       |
| [make\_timestamp\_ntz(year,month,day,hour,min,sec)](https://docs.databricks.com/aws/en/sql/language-manual/functions/make_timestamp_ntz.md)                                   | Creates a timestamp without a time zone from date and time fields.                                                                                                                                                                                                          |
| [make\_ym\_interval(\[years\[, months\]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/make_ym_interval.md)                                             | Creates a year-month interval from `years`, and `months`.                                                                                                                                                                                                                   |
| [minute(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/minute.md)                                                                                    | Returns the minute component of the timestamp in `expr`.                                                                                                                                                                                                                    |
| [month(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/month.md)                                                                                      | Returns the month component of the timestamp in `expr`.                                                                                                                                                                                                                     |
| [monthname(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/monthname.md)                                                                              | Returns the three-letter English abbreviation for the month of `expr`.                                                                                                                                                                                                      |
| [months\_between(expr1,expr2\[,roundOff\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/months_between.md)                                               | Returns the number of months elapsed between dates or timestamps in `expr1` and `expr2`.                                                                                                                                                                                    |
| [next\_day(expr,dayOfWeek)](https://docs.databricks.com/aws/en/sql/language-manual/functions/next_day.md)                                                                     | Returns the first date which is later than `expr` and named as in `dayOfWeek`.                                                                                                                                                                                              |
| [now(\[precision\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/now.md)                                                                                 | Returns the current timestamp at the start of query evaluation.                                                                                                                                                                                                             |
| [parse\_timestamp(expr \[, pattern \[, ...\] \])](https://docs.databricks.com/aws/en/sql/language-manual/functions/parse_timestamp.md)                                        | Parses string or numeric `expr` to a timestamp using an optional pattern list (default `#extended`); errors if no pattern matches.                                                                                                                                          |
| [quarter(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/quarter.md)                                                                                  | Returns the quarter of the year for `expr` in the range 1 to 4.                                                                                                                                                                                                             |
| [second(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/second.md)                                                                                    | Returns the second component of the timestamp in `expr`.                                                                                                                                                                                                                    |
| [session\_window(expr, gpDuration)](https://docs.databricks.com/aws/en/sql/language-manual/functions/session_window.md)                                                       | Creates a session-window over a timestamp expression.                                                                                                                                                                                                                       |
| [sign(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/sign.md)                                                                                        | Returns -1.0, 0.0, or 1.0 as interval `expr` is negative, 0, or positive.                                                                                                                                                                                                   |
| [signum(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/signum.md)                                                                                    | Returns -1.0, 0.0, or 1.0 as interval `expr` is negative, 0, or positive.                                                                                                                                                                                                   |
| [time(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/time.md)                                                                                        | Casts `expr` to `TIME`.                                                                                                                                                                                                                                                     |
| [timediff(unit, start, stop)](https://docs.databricks.com/aws/en/sql/language-manual/functions/timediff.md)                                                                   | Returns the difference between two timestamps measured in `unit`s.                                                                                                                                                                                                          |
| [time\_bucket(bucketSize, ts \[, origin\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/time_bucket.md)                                                  | Returns the start of the fixed-width time bucket that `ts` falls into, aligned to `origin`.                                                                                                                                                                                 |
| [time\_diff(unit, start, stop)](https://docs.databricks.com/aws/en/sql/language-manual/functions/time_diff.md)                                                                | Returns the difference between two time values measured in `unit`s.                                                                                                                                                                                                         |
| [time\_from\_micros(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/time_from_micros.md)                                                              | Creates a time from microseconds since midnight.                                                                                                                                                                                                                            |
| [time\_from\_millis(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/time_from_millis.md)                                                              | Creates a time from milliseconds since midnight.                                                                                                                                                                                                                            |
| [time\_from\_seconds(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/time_from_seconds.md)                                                            | Creates a time from seconds since midnight.                                                                                                                                                                                                                                 |
| [time\_to\_micros(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/time_to_micros.md)                                                                  | Returns microseconds since midnight for a time value.                                                                                                                                                                                                                       |
| [time\_to\_millis(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/time_to_millis.md)                                                                  | Returns milliseconds since midnight for a time value.                                                                                                                                                                                                                       |
| [time\_to\_seconds(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/time_to_seconds.md)                                                                | Returns seconds since midnight for a time value.                                                                                                                                                                                                                            |
| [time\_trunc(unit, expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/time_trunc.md)                                                                     | Returns a time value truncated to the unit specified in `unit`.                                                                                                                                                                                                             |
| [timestamp(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/timestamp.md)                                                                              | Casts `expr` to `TIMESTAMP`.                                                                                                                                                                                                                                                |
| [timestamp\_micros(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/timestamp_micros.md)                                                               | Creates a timestamp `expr` microseconds since UTC epoch.                                                                                                                                                                                                                    |
| [timestamp\_millis(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/timestamp_millis.md)                                                               | Creates a timestamp `expr` milliseconds since UTC epoch.                                                                                                                                                                                                                    |
| [timestamp\_nanos(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/timestamp_nanos.md)                                                                 | Creates a timestamp from nanoseconds since the UTC epoch.                                                                                                                                                                                                                   |
| [timestamp\_seconds(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/timestamp_seconds.md)                                                             | Creates timestamp `expr` seconds since UTC epoch.                                                                                                                                                                                                                           |
| [timestampadd(unit, value, expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/timestampadd.md)                                                           | Adds `value` `unit`s to a timestamp `expr`.                                                                                                                                                                                                                                 |
| [timestampdiff(unit, start, stop)](https://docs.databricks.com/aws/en/sql/language-manual/functions/timestampdiff.md)                                                         | Returns the difference between two timestamps measured in `unit`s.                                                                                                                                                                                                          |
| [to\_date(expr\[,fmt\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/to_date.md)                                                                         | Returns `expr` cast to a date using an optional formatting.                                                                                                                                                                                                                 |
| [to\_time(expr\[,fmt\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/to_time.md)                                                                         | Returns `expr` cast to a time using an optional formatting.                                                                                                                                                                                                                 |
| [to\_timestamp(expr\[,fmt\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/to_timestamp.md)                                                               | Returns `expr` cast to a timestamp using optional formatting.                                                                                                                                                                                                               |
| [to\_timestamp\_ltz(expr\[,fmt\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/to_timestamp_ltz.md)                                                      | Returns `expr` cast to a timestamp with a local time zone using optional formatting.                                                                                                                                                                                        |
| [to\_timestamp\_ntz(expr\[,fmt\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/to_timestamp_ntz.md)                                                      | Returns `expr` cast to a timestamp without a time zone using optional formatting.                                                                                                                                                                                           |
| [to\_unix\_timestamp(expr\[,fmt\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/to_unix_timestamp.md)                                                    | Returns the timestamp in `expr` as a UNIX timestamp.                                                                                                                                                                                                                        |
| [to\_utc\_timestamp(expr,timezone)](https://docs.databricks.com/aws/en/sql/language-manual/functions/to_utc_timestamp.md)                                                     | Returns the timestamp at `UTC` for a timestamp `expr` at `timezone`.                                                                                                                                                                                                        |
| [trunc(expr, fmt)](https://docs.databricks.com/aws/en/sql/language-manual/functions/trunc.md)                                                                                 | Returns a date with the a portion of the date truncated to the unit specified by the format model `fmt`.                                                                                                                                                                    |
| [try\_add(expr1, expr2)](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_add.md)                                                                         | Returns the sum of `expr1` and `expr2`, or NULL in case of error.                                                                                                                                                                                                           |
| [try\_divide(dividend, divisor)](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_divide.md)                                                              | Returns `dividend` divided by `divisor`, or NULL if `divisor` is 0.                                                                                                                                                                                                         |
| [try\_multiply(multiplier, multiplicand)](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_multiply.md)                                                   | Returns `multiplier` multiplied by `multiplicand`, or `NULL` on overflow.                                                                                                                                                                                                   |
| [try\_make\_interval(years\[,months\[,weeks\[,days\[,hours\[,mins\[,secs\]\]\]\]\]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_make_interval.md) | Creates an interval, or returns `NULL` if the interval cannot be created.                                                                                                                                                                                                   |
| [try\_make\_timestamp(year,month,day,hour,min,sec\[,timezone\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_make_timestamp.md)                      | Creates a timestamp, or returns `NULL` if the timestamp cannot be created.                                                                                                                                                                                                  |
| [try\_make\_timestamp\_ltz(year,month,day,hour,min,sec\[,timezone\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_make_timestamp_ltz.md)             | Creates a timestamp with a local time zone, or returns `NULL` if the timestamp cannot be created.                                                                                                                                                                           |
| [try\_make\_timestamp\_ntz(year,month,day,hour,min,sec)](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_make_timestamp_ntz.md)                          | Creates a timestamp without a time zone, or returns `NULL` if the timestamp cannot be created.                                                                                                                                                                              |
| [try\_parse\_timestamp(expr \[, pattern \[, ...\] \])](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_parse_timestamp.md)                               | Parses string or numeric `expr` to a timestamp using an optional pattern list (default `#extended`), or `NULL` if parsing fails.                                                                                                                                            |
| [try\_subtract(expr1, expr2)](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_subtract.md)                                                               | Returns the subtraction of `expr2` from `expr1`, or `NULL` on overflow.                                                                                                                                                                                                     |
| [try\_to\_date(expr\[,fmt\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_to_date.md)                                                                | Returns `expr` cast to a date using optional formatting, or `NULL` if the cast fails.                                                                                                                                                                                       |
| [try\_to\_time(expr\[,fmt\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_to_time.md)                                                                | Returns `expr` cast to a time using an optional formatting, or `NULL` if the cast fails.                                                                                                                                                                                    |
| [try\_to\_timestamp(expr\[,fmt\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_to_timestamp.md)                                                      | Returns `expr` cast to a timestamp using optional formatting, or `NULL` if the cast fails.                                                                                                                                                                                  |
| [unix\_date(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/unix_date.md)                                                                             | Returns the number of days since `1970-01-01`.                                                                                                                                                                                                                              |
| [unix\_micros(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/unix_micros.md)                                                                         | Returns the number of microseconds since `1970-01-01 00:00:00 UTC`.                                                                                                                                                                                                         |
| [unix\_millis(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/unix_millis.md)                                                                         | Returns the number of milliseconds since `1970-01-01 00:00:00 UTC`.                                                                                                                                                                                                         |
| [unix\_nanos(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/unix_nanos.md)                                                                           | Returns the number of nanoseconds since `1970-01-01 00:00:00 UTC`.                                                                                                                                                                                                          |
| [unix\_seconds(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/unix_seconds.md)                                                                       | Returns the number of seconds since `1970-01-01 00:00:00 UTC`.                                                                                                                                                                                                              |
| [unix\_timestamp(\[expr\[, fmt\]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/unix_timestamp.md)                                                      | Returns the UNIX timestamp of current or specified time.                                                                                                                                                                                                                    |
| [weekday(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/weekday.md)                                                                                  | Returns the day of the week of `expr`.                                                                                                                                                                                                                                      |
| [weekofyear(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/weekofyear.md)                                                                            | Returns the week of the year of `expr`.                                                                                                                                                                                                                                     |
| [year(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/year.md)                                                                                        | Returns the year component of `expr`.                                                                                                                                                                                                                                       |
| [window(expr, width\[, step\[, start\]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/window.md)                                                        | Creates a hopping based sliding-window over a timestamp expression.                                                                                                                                                                                                         |
| [window\_time(window)](https://docs.databricks.com/aws/en/sql/language-manual/functions/window_time.md)                                                                       | Returns the inclusive end time of a sliding-window produced by the [window](https://docs.databricks.com/aws/en/sql/language-manual/functions/window.md) or [session\_window](https://docs.databricks.com/aws/en/sql/language-manual/functions/session_window.md) functions. |

## <a id="h3-geospatial-functions" />H3 geospatial functions

For information about H3 geospatial functions, see [H3 geospatial functions](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-h3-geospatial-functions.md).

## <a id="st-geospatial-functions" />ST geospatial functions

For information about ST geospatial functions, see [ST geospatial functions](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-st-geospatial-functions.md).

## <a id="ip-functions" />IP functions

For information about IP functions, see [IP functions](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-ip-functions.md).

## <a id="match-recognize-functions" />MATCH\_RECOGNIZE functions

Navigation and metadata functions for [MATCH\_RECOGNIZE](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-qry-select-match-recognize.md). Use them only in the [MEASURES](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-qry-select-match-recognize-measures.md) and [DEFINE](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-qry-select-match-recognize-define.md) clauses.

If you use one of these functions outside `MATCH_RECOGNIZE`, Databricks raises [MATCH\_RECOGNIZE\_FUNCTION\_OUTSIDE\_MATCH\_RECOGNIZE](https://docs.databricks.com/aws/en/error-messages/error-classes.md#match_recognize_function_outside_match_recognize).

| Function                                                                                                                 | Description                                                                |
| ------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------- |
| [classifier()](https://docs.databricks.com/aws/en/sql/language-manual/functions/classifier.md)                           | Returns the name of the pattern variable that the current row matched.     |
| [first(colName \[, offset\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/match_recognize_first.md) | Returns a column value relative to the first row in the match.             |
| [last(colName \[, offset\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/match_recognize_last.md)   | Returns a column value relative to the last row in the match.              |
| [match\_number()](https://docs.databricks.com/aws/en/sql/language-manual/functions/match_number.md)                      | Returns the sequential number of the match within each partition.          |
| [next(colName \[, offset\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/match_recognize_next.md)   | Returns a following column value relative to the current row in the match. |
| [prev(colName \[, offset\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/match_recognize_prev.md)   | Returns a preceding column value relative to the current row in the match. |

## Cast functions and constructors

For information on casting between types, see [`cast` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/cast.md) and [`try_cast` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_cast.md).

| Function                                                                                                                                                                 | Description                                                                                         |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------- |
| [array(\[expr \[, …\]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/array.md)                                                                     | Returns an array with the elements in `expr`.                                                       |
| [bigint(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/bigint.md)                                                                               | Casts the value `expr` to `BIGINT`.                                                                 |
| [binary(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/binary.md)                                                                               | Casts the value of `expr` to `BINARY`.                                                              |
| [boolean(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/boolean.md)                                                                             | Casts `expr` to `BOOLEAN`.                                                                          |
| [cast(expr AS type)](https://docs.databricks.com/aws/en/sql/language-manual/functions/cast.md)                                                                           | Casts the value `expr` to the target data type `type`.                                              |
| [expr :: type](https://docs.databricks.com/aws/en/sql/language-manual/functions/coloncolonsign.md)                                                                       | Casts the value `expr` to the target data type `type`.                                              |
| [date(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/date.md)                                                                                   | Casts the value `expr` to `DATE`.                                                                   |
| [decimal(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/decimal.md)                                                                             | Casts the value `expr` to `DECIMAL`.                                                                |
| [double(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/double.md)                                                                               | Casts the value `expr` to `DOUBLE`.                                                                 |
| [float(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/float.md)                                                                                 | Casts the value `expr` to `FLOAT`.                                                                  |
| [int(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/int.md)                                                                                     | Casts the value `expr` to `INTEGER`.                                                                |
| [make\_date(year,month,day)](https://docs.databricks.com/aws/en/sql/language-manual/functions/make_date.md)                                                              | Creates a date from `year`, `month`, and `day` fields.                                              |
| [make\_dt\_interval(\[days\[, hours\[, mins\[, secs\]\]\]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/make_dt_interval.md)                      | Creates an day-time interval from `days`, `hours`, `mins` and `secs`.                               |
| [make\_interval(\[years\[,months\[,weeks\[,days\[,hours\[,mins\[,secs\]\]\]\]\]\]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/make_interval.md) | Creates an interval from `years`, `months`, `weeks`, `days`, `hours`, `mins` and `secs`.            |
| [make\_time(hour, minute, second)](https://docs.databricks.com/aws/en/sql/language-manual/functions/make_time.md)                                                        | Creates a time from `hour`, `minute`, and `second` fields.                                          |
| [make\_timestamp(year,month,day,hour,min,sec\[,timezone\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/make_timestamp.md)                          | Creates a timestamp from `year`, `month`, `day`, `hour`, `min`, `sec`, and `timezone` fields.       |
| [make\_timestamp\_ltz(year,month,day,hour,min,sec\[,timezone\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/make_timestamp_ltz.md)                 | Creates a timestamp with a local time zone from date and time fields.                               |
| [make\_timestamp\_ntz(year,month,day,hour,min,sec)](https://docs.databricks.com/aws/en/sql/language-manual/functions/make_timestamp_ntz.md)                              | Creates a timestamp without a time zone from date and time fields.                                  |
| [make\_ym\_interval(\[years\[, months\]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/make_ym_interval.md)                                        | Creates a year-month interval from `years`, and `months`.                                           |
| [map(\[\{key1, value1} \[, …\]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/map.md)                                                              | Creates a map with the specified key-value pairs.                                                   |
| [named\_struct(\{name1, val1} \[, …\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/named_struct.md)                                                | Creates a struct with the specified field names and values.                                         |
| [smallint(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/smallint.md)                                                                           | Casts the value `expr` to `SMALLINT`.                                                               |
| [string(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/string.md)                                                                               | Casts the value `expr` to `STRING`.                                                                 |
| [struct(expr1 \[, …\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/struct.md)                                                                      | Creates a `STRUCT` with the specified field values.                                                 |
| [tinyint(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/tinyint.md)                                                                             | Casts `expr` to `TINYINT`.                                                                          |
| [time(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/time.md)                                                                                   | Casts `expr` to `TIME`.                                                                             |
| [timestamp(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/timestamp.md)                                                                         | Casts `expr` to `TIMESTAMP`.                                                                        |
| [to\_char(expr, fmt)](https://docs.databricks.com/aws/en/sql/language-manual/functions/to_char.md)                                                                       | Returns `expr` cast to `STRING` using formatting `fmt`.                                             |
| [to\_date(expr\[,fmt\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/to_date.md)                                                                    | Returns `expr` cast to a date using an optional formatting.                                         |
| [to\_number(expr, fmt)](https://docs.databricks.com/aws/en/sql/language-manual/functions/to_number.md)                                                                   | Returns `expr` cast to `DECIMAL` using formatting `fmt`.                                            |
| [to\_time(expr\[,fmt\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/to_time.md)                                                                    | Returns `expr` cast to a time using an optional formatting.                                         |
| [to\_timestamp(expr\[,fmt\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/to_timestamp.md)                                                          | Returns `expr` cast to a timestamp using optional formatting.                                       |
| [to\_timestamp\_ltz(expr\[,fmt\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/to_timestamp_ltz.md)                                                 | Returns `expr` cast to a timestamp with a local time zone using optional formatting.                |
| [to\_timestamp\_ntz(expr\[,fmt\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/to_timestamp_ntz.md)                                                 | Returns `expr` cast to a timestamp without a time zone using optional formatting.                   |
| [to\_varchar(expr, fmt)](https://docs.databricks.com/aws/en/sql/language-manual/functions/to_varchar.md)                                                                 | Returns `expr` cast to `STRING` using formatting `fmt`.                                             |
| [try\_cast(expr AS type)](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_cast.md)                                                                  | Casts the value `expr` to the target data type `type` safely.                                       |
| [try\_to\_date(expr\[,fmt\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_to_date.md)                                                           | Returns `expr` cast to a date using optional formatting, or `NULL` if the cast fails.               |
| [try\_to\_number(expr, fmt)](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_to_number.md)                                                          | Returns `expr` cast to `DECIMAL` using formatting `fmt`, or `NULL` if `expr` is not a valid number. |
| [try\_to\_time(expr\[,fmt\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_to_time.md)                                                           | Returns `expr` cast to a time using an optional formatting, or `NULL` if the cast fails.            |

## CSV and Avro functions

| Function                                                                                                                              | Description                                                                    |
| ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
| [from\_avro(avroBin, jsonSchema\[, options\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/from_avro.md)         | Returns a struct value based on `avroBin` and `jsonSchema`.                    |
| [from\_csv(csvStr, schema\[, options\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/from_csv.md)                | Returns a struct value with the `csvStr` and `schema`.                         |
| [schema\_of\_avro(jsonFormatSchema\[, options\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/schema_of_avro.md) | Returns the schema of an Avro schema in JSON format as a DDL-formatted string. |
| [schema\_of\_csv(csv\[, options\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/schema_of_csv.md)                | Returns the schema of a CSV string in DDL format.                              |
| [to\_avro(expr\[, options\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/to_avro.md)                            | Returns an Avro binary value with the specified struct value.                  |
| [to\_csv(expr\[, options\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/to_csv.md)                              | Returns a CSV string with the specified struct value.                          |

## Protobuf functions

| Function                                                                                                                                              | Description                                                                                     |
| ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| [from\_protobuf(data, messageName\[, descFilePath\]\[, options\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/from_protobuf.md) | Converts a binary Protobuf value into a struct using the specified Protobuf message definition. |
| [to\_protobuf(data, messageName\[, descFilePath\]\[, options\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/to_protobuf.md)     | Converts a struct into a Protobuf-encoded binary value using the specified message definition.  |

## JSON functions

| Function                                                                                                                              | Description                                                               |
| ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| [jsonStr : jsonPath](https://docs.databricks.com/aws/en/sql/language-manual/functions/colonsign.md)                                   | Returns fields extracted from the `jsonStr`.                              |
| [from\_json(jsonStr, schema\[, options\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/from_json.md)             | Returns a struct value with the `jsonStr` and `schema`.                   |
| [get\_json\_object(expr, path)](https://docs.databricks.com/aws/en/sql/language-manual/functions/get_json_object.md)                  | Extracts a `JSON` object from `path`.                                     |
| [json\_array\_length(jsonArray)](https://docs.databricks.com/aws/en/sql/language-manual/functions/json_array_length.md)               | Returns the number of elements in the outermost `JSON` array.             |
| [json\_object\_keys(jsonObject) ](https://docs.databricks.com/aws/en/sql/language-manual/functions/json_object_keys.md)               | Returns all the keys of the outermost `JSON` object as an array.          |
| [json\_tuple(jsonStr, path1 \[, …\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/json_tuple.md)                 | Returns multiple `JSON` objects as a tuple.                               |
| [parse\_json(jsonStr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/parse_json.md)                                | Returns a `VARIANT` value from the `jsonStr`.                             |
| [schema\_of\_json(jsonStr\[, options\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/schema_of_json.md)          | Returns the schema of a `JSON` string in DDL format.                      |
| [schema\_of\_json\_agg(jsonStr\[, options\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/schema_of_json_agg.md) | Returns the combined schema of `JSON` strings in a group in DDL format.   |
| [to\_json(expr\[, options\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/to_json.md)                            | Returns a JSON string with the `STRUCT` or `VARIANT` specified in `expr`. |

## VARIANT functions

| Function                                                                                                                                                   | Description                                                                                                                                                  |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [variantExpr : jsonPath](https://docs.databricks.com/aws/en/sql/language-manual/functions/colonsign.md)                                                    | Returns fields extracted from the `variantExpr` using JSON path.                                                                                             |
| [is\_variant\_null(variantExpr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/is_variant_null.md)                                      | Tests whether `variantExpr` is a `VARIANT`-encoded `NULL`.                                                                                                   |
| [parse\_json(jsonStr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/parse_json.md)                                                     | Returns a `VARIANT` value from the `jsonStr`.                                                                                                                |
| [schema\_of\_variant(variantExpr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/schema_of_variant.md)                                  | Returns the schema of a `VARIANT` expression in DDL format.                                                                                                  |
| [schema\_of\_variant\_agg(variantExpr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/schema_of_variant_agg.md)                         | Returns the combined schema of all `VARIANT` values in a group in DDL format.                                                                                |
| [to\_json(expr\[, options\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/to_json.md)                                                 | Returns a JSON string with the `STRUCT` or `VARIANT` specified in `expr`.                                                                                    |
| [to\_variant\_object(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/to_variant_object.md)                                         | Converts a complex expression (`ARRAY`, `MAP`, `STRUCT`) into a `VARIANT` where maps and structs are converted to variant objects.                           |
| [try\_parse\_json(jsonStr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_parse_json.md)                                            | Returns a `VARIANT` value from the `jsonStr` if possible. If not possible, `NULL` is returned.                                                               |
| [try\_variant\_array\_append(variantExpr, path, val)](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_variant_array_append.md)        | Returns `variantExpr` with `val` appended to the array at `path`, or `NULL` if an intermediate value has an incompatible type or the target is not an array. |
| [try\_variant\_get(variantExpr,path,type)](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_variant_get.md)                            | Extracts a value of `type` type from `variantExpr`, specified by `path`, or `NULL` if it is not possible to cast to the target type.                         |
| [try\_variant\_insert(variantExpr, path, val)](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_variant_insert.md)                     | Returns `variantExpr` with `val` inserted at `path`, or `NULL` for duplicate object fields or incompatible intermediate types.                               |
| [try\_variant\_set(variantExpr, path, val \[, create\_if\_missing\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_variant_set.md) | Returns `variantExpr` with `val` inserted or set at `path`, or `NULL` for incompatible intermediate types.                                                   |
| [variant\_array\_append(variantExpr, path, val)](https://docs.databricks.com/aws/en/sql/language-manual/functions/variant_array_append.md)                 | Returns `variantExpr` with `val` appended to the array at `path`.                                                                                            |
| [variant\_delete(variantExpr, path1 \[, path2, ...\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/variant_delete.md)                 | Returns `variantExpr` with the fields or array elements at the specified paths removed.                                                                      |
| [variant\_explode(input)](https://docs.databricks.com/aws/en/sql/language-manual/functions/variant_explode.md)                                             | Returns a set of rows by un-nesting `input`.                                                                                                                 |
| [variant\_explode\_outer(input)](https://docs.databricks.com/aws/en/sql/language-manual/functions/variant_explode_outer.md)                                | Returns a set of rows by un-nesting `input` using outer semantics.                                                                                           |
| [variant\_get(variantExpr,path,type)](https://docs.databricks.com/aws/en/sql/language-manual/functions/variant_get.md)                                     | Extracts a value of `type` type from `variantExpr`, specified by `path`.                                                                                     |
| [variant\_insert(variantExpr, path, val)](https://docs.databricks.com/aws/en/sql/language-manual/functions/variant_insert.md)                              | Returns `variantExpr` with `val` inserted as a field or array element at `path`.                                                                             |
| [variant\_pick(variantExpr, path1 \[, path2, ...\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/variant_pick.md)                     | Returns a `VARIANT` containing only the fields and array elements of `variantExpr` selected by the specified paths.                                          |
| [variant\_set(variantExpr, path, val \[, create\_if\_missing\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/variant_set.md)          | Returns `variantExpr` with `val` inserted or set at `path`.                                                                                                  |
| [variant\_strip\_nulls(variantExpr \[, include\_arrays\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/variant_strip_nulls.md)        | Returns `variantExpr` with variant null fields recursively removed from objects and, optionally, variant null elements removed from arrays.                  |

## File functions

| Function                                                                                                                                                        | Description                                                                                                            |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| [copy\_file(file => file \[, …\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/copy_file.md)                                               | Copies a file to a destination path and returns the new `FILE` reference.                                              |
| [create\_file(content => content \[, …\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/create_file.md)                                     | Uploads string or binary content to a path and returns a `FILE` reference.                                             |
| [list\_files(path \[, connection => connection\] \[, recursive => recursive\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/list_files.md) | Returns the list of files at a path, including a `FILE` reference for each file.                                       |
| [to\_file(path)](https://docs.databricks.com/aws/en/sql/language-manual/functions/to_file.md)                                                                   | Returns a `FILE` reference for the file at `path`.                                                                     |
| [try\_copy\_file(file => file \[, …\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_copy_file.md)                                      | Copies a file to a destination path and returns the new `FILE` reference, or `NULL` if the source file does not exist. |
| [try\_to\_file(path)](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_to_file.md)                                                          | Returns a `FILE` reference for the file at `path`, or `NULL` if the file does not exist.                               |

## XPath and XML functions

| Function                                                                                                                  | Description                                                                                            |
| ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| [from\_xml(xmlStr, schema\[, options\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/from_xml.md)    | Returns a struct value parsed from the `xmlStr` using `schema`.                                        |
| [schema\_of\_xml(xmlStr\[, options\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/schema_of_xml.md) | Returns the schema of a `XML` string in DDL format.                                                    |
| [xpath(xml, xpath)](https://docs.databricks.com/aws/en/sql/language-manual/functions/xpath.md)                            | Returns values within the nodes of `xml` that match `xpath`.                                           |
| [xpath\_boolean(xml, xpath)](https://docs.databricks.com/aws/en/sql/language-manual/functions/xpath_boolean.md)           | Returns `true` if the `xpath` expression evaluates to `true`, or if a matching node in `xml` is found. |
| [xpath\_double(xml, xpath)](https://docs.databricks.com/aws/en/sql/language-manual/functions/xpath_double.md)             | Returns a `DOUBLE` value from an XML document.                                                         |
| [xpath\_float(xml, xpath)](https://docs.databricks.com/aws/en/sql/language-manual/functions/xpath_float.md)               | Returns a `FLOAT` value from an XML document.                                                          |
| [xpath\_int(xml, xpath)](https://docs.databricks.com/aws/en/sql/language-manual/functions/xpath_int.md)                   | Returns a `INTEGER` value from an XML document.                                                        |
| [xpath\_long(xml, xpath)](https://docs.databricks.com/aws/en/sql/language-manual/functions/xpath_long.md)                 | Returns a `BIGINT` value from an XML document.                                                         |
| [xpath\_number(xml, xpath)](https://docs.databricks.com/aws/en/sql/language-manual/functions/xpath_number.md)             | Returns a `DOUBLE` value from an XML document.                                                         |
| [xpath\_short(xml, xpath)](https://docs.databricks.com/aws/en/sql/language-manual/functions/xpath_short.md)               | Returns a `SHORT` value from an XML document.                                                          |
| [xpath\_string(xml, xpath)](https://docs.databricks.com/aws/en/sql/language-manual/functions/xpath_string.md)             | Returns the contents of the first XML node that matches the XPath expression.                          |

## AI functions

| Function                                                                                                                                                 | Description                                                                                                                                                                                         |
| -------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [ai\_analyze\_sentiment(content)](https://docs.databricks.com/aws/en/sql/language-manual/functions/ai_analyze_sentiment.md)                              | Returns the sentiment of a text.                                                                                                                                                                    |
| [ai\_classify(content, labels)](https://docs.databricks.com/aws/en/sql/language-manual/functions/ai_classify.md)                                         | Classifies the provided content into one of the provided labels.                                                                                                                                    |
| [ai\_decide(state, questions \[, options\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/ai_decide.md)                              | Evaluates questions against text or structured data and returns probabilities, choices, and scores.                                                                                                 |
| [ai\_detect\_anomalies(observed, time\_col, value\_col)](https://docs.databricks.com/aws/en/sql/language-manual/functions/ai_detect_anomalies.md)        | Identifies anomalous values in time series data.                                                                                                                                                    |
| [ai\_enrich(content, schema)](https://docs.databricks.com/aws/en/sql/language-manual/functions/ai_enrich.md)                                             | Generates new columns for a row from a schema you provide.                                                                                                                                          |
| [ai\_extract(content, schema \[, options\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/ai_extract.md)                             | Extracts structured data from text according to a schema you provide.                                                                                                                               |
| [ai\_fix\_grammar(content)](https://docs.databricks.com/aws/en/sql/language-manual/functions/ai_fix_grammar.md)                                          | Corrects grammatical errors in a given text.                                                                                                                                                        |
| [ai\_forecast(observed, time\_col)](https://docs.databricks.com/aws/en/sql/language-manual/functions/ai_forecast.md)                                     | Extrapolates time series data into the future.                                                                                                                                                      |
| [ai\_gen(content)](https://docs.databricks.com/aws/en/sql/language-manual/functions/ai_gen.md)                                                           | Invokes a state-of-the-art AI model from [Databricks Foundation Model APIs](https://docs.databricks.com/aws/en/machine-learning/foundation-model-apis/index.md) to answer the user-provided prompt. |
| [ai\_generate\_text(prompt, modelName\[, param1, value1\] \[…\]) ](https://docs.databricks.com/aws/en/sql/language-manual/functions/ai_generate_text.md) | Deprecated: Returns text generated by a selected large language model (LLM) given the prompt.                                                                                                       |
| [ai\_mask(content, labels)](https://docs.databricks.com/aws/en/sql/language-manual/functions/ai_mask.md)                                                 | Masks specified entities within a given text.                                                                                                                                                       |
| [ai\_parse\_document(content)](https://docs.databricks.com/aws/en/sql/language-manual/functions/ai_parse_document.md)                                    | Parse content from unstructured documents in a structured format.                                                                                                                                   |
| [ai\_predict\_class(input, target\_col, feature\_cols \[, seed\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/ai_predict_class.md) | Trains a classification model and predicts class labels for rows where the target column is `NULL`.                                                                                                 |
| [ai\_predict\_value(input, target\_col, feature\_cols \[, seed\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/ai_predict_value.md) | Trains a regression model and predicts numeric values for rows where the target column is `NULL`.                                                                                                   |
| [ai\_prep\_search(parsed)](https://docs.databricks.com/aws/en/sql/language-manual/functions/ai_prep_search.md)                                           | Transforms parsed documents or plain text and markdown into search-ready chunks for AI Search indexing.                                                                                             |
| [ai\_query(endpoint, request \[, returnType\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/ai_query.md)                            | Invokes an existing Model Serving endpoint and parses and returns its response.                                                                                                                     |
| [ai\_search(query, knowledge\_sources)](https://docs.databricks.com/aws/en/sql/language-manual/functions/ai_search.md)                                   | Retrieves ranked, deduplicated documents and a grounded answer for a natural-language query over one or more knowledge sources.                                                                     |
| [ai\_similarity(strExpr1, strExpr2)](https://docs.databricks.com/aws/en/sql/language-manual/functions/ai_similarity.md)                                  | Compares two strings and computes the semantic similarity score.                                                                                                                                    |
| [ai\_summarize(content\[, max\_words\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/ai_summarize.md)                               | Generates a summary of a given text.                                                                                                                                                                |
| [ai\_translate(content, to\_lang)](https://docs.databricks.com/aws/en/sql/language-manual/functions/ai_translate.md)                                     | Translates text to a specified target language.                                                                                                                                                     |
| [vector\_cosine\_similarity(vector1, vector2)](https://docs.databricks.com/aws/en/sql/language-manual/functions/vector_cosine_similarity.md)             | Computes the cosine similarity between two `ARRAY<FLOAT>` vectors.                                                                                                                                  |
| [vector\_inner\_product(vector1, vector2)](https://docs.databricks.com/aws/en/sql/language-manual/functions/vector_inner_product.md)                     | Computes the inner product (dot product) between two `ARRAY<FLOAT>` vectors.                                                                                                                        |
| [vector\_l2\_distance(vector1, vector2)](https://docs.databricks.com/aws/en/sql/language-manual/functions/vector_l2_distance.md)                         | Computes the Euclidean (L2) distance between two `ARRAY<FLOAT>` vectors.                                                                                                                            |
| [vector\_norm(vector \[, degree \])](https://docs.databricks.com/aws/en/sql/language-manual/functions/vector_norm.md)                                    | Computes the Lp norm of an `ARRAY<FLOAT>` vector (degree 1.0, 2.0, or `float('inf')`).                                                                                                              |
| [vector\_normalize(vector \[, degree \])](https://docs.databricks.com/aws/en/sql/language-manual/functions/vector_normalize.md)                          | Normalizes an `ARRAY<FLOAT>` vector to unit length using the specified norm degree.                                                                                                                 |
| [vector\_search(index, query, num\_results)](https://docs.databricks.com/aws/en/sql/language-manual/functions/vector_search.md)                          | Query an [AI Search](https://docs.databricks.com/aws/en/ai-search/ai-search.md) index using SQL.                                                                                                    |

## Read functions

| Function                                                                                                                                                                 | Description                                                                       |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------- |
| [read\_files(path, \[optionKey => optionValue\] \[, …\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/read_files.md)                                | Reads data files on cloud storage and returns it in tabular format.               |
| [read\_kafka(\[optionKey => optionValue\] \[, …\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/read_kafka.md)                                      | Reads records from an Apache Kafka cluster and returns it in tabular format.      |
| [read\_kinesis(\{parameter => value} \[, …\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/read_kinesis.md)                                         | Returns a table with records read from *Kinesis* from one or more streams.        |
| [read\_pubsub(\[parameter => value\] \[, …\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/read_pubsub.md)                                          | A table valued function for reading records from Pub/Sub from a topic.            |
| [read\_pulsar(\{optionKey => optionValue} \[, …\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/read_pulsar.md)                                     | Returns a table with records read from Pulsar.                                    |
| [read\_state\_metadata(path)](https://docs.databricks.com/aws/en/sql/language-manual/functions/read_state_metadata.md)                                                   | Returns a table with rows that represent the metadata of a streaming query state. |
| [read\_statestore(path \[, option\_key => option\_value\] \[…\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/read_statestore.md)                   | Returns records from the state store of streaming queries.                        |
| [remote\_query(connectionName \[, connectorOptionKey => connectorOptionValue\] \[…\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/remote_query.md) | Returns the tabular result of the query executed on the remote database engine.   |

## Miscellaneous functions

| Function                                                                                                                                                                    | Description                                                                                                                                                                                        |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [approx\_top\_k\_estimate(state \[, k \])](https://docs.databricks.com/aws/en/sql/language-manual/functions/approx_top_k_estimate.md)                                       | Returns the top K most frequent items with estimated counts from an approx\_top\_k sketch state.                                                                                                   |
| [assert\_true(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/assert_true.md)                                                                       | Returns an error if `expr` is not true.                                                                                                                                                            |
| [CASE expr \{ WHEN opt1 THEN res1 } \[…\] \[ELSE def\] END](https://docs.databricks.com/aws/en/sql/language-manual/functions/case.md)                                       | Returns `resN` for the first `optN` that equals `expr` or `def` if none matches.                                                                                                                   |
| [CASE \{ WHEN cond1 THEN res1 } \[…\] \[ELSE def\] END](https://docs.databricks.com/aws/en/sql/language-manual/functions/case.md)                                           | Returns `resN` for the first `condN` that evaluates to true, or `def` if none found.                                                                                                               |
| [cloud\_files\_state( \{ TABLE(table) \| checkpoint } )](https://docs.databricks.com/aws/en/sql/language-manual/functions/cloud_files_state.md)                             | Returns the file-level state of an Auto Loader `cloud_files` source.                                                                                                                               |
| [coalesce(expr1, expr2 \[, …\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/coalesce.md)                                                              | Returns the first non-null argument.                                                                                                                                                               |
| [collations()](https://docs.databricks.com/aws/en/sql/language-manual/functions/collations.md)                                                                              | Returns the list of available collations.                                                                                                                                                          |
| [cube (expr1 \[, …\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/cube.md)                                                                            | Creates a multi-dimensional cube using the specified expression columns.                                                                                                                           |
| [current\_catalog()](https://docs.databricks.com/aws/en/sql/language-manual/functions/current_catalog.md)                                                                   | Returns the current catalog.                                                                                                                                                                       |
| [current\_database()](https://docs.databricks.com/aws/en/sql/language-manual/functions/current_database.md)                                                                 | Returns the current schema.                                                                                                                                                                        |
| [current\_metastore()](https://docs.databricks.com/aws/en/sql/language-manual/functions/current_metastore.md)                                                               | Returns the current Unity Catalog Metastore id.                                                                                                                                                    |
| [current\_oauth\_custom\_identity\_claim()](https://docs.databricks.com/aws/en/sql/language-manual/functions/current_oauth_custom_identity_claim.md)                        | Returns the custom identity claim in the OAuth token for the current session.                                                                                                                      |
| [current\_recipient(key)](https://docs.databricks.com/aws/en/sql/language-manual/functions/current_recipient.md)                                                            | Returns a property for the current recipient in a view shared with OpenSharing.                                                                                                                    |
| [current\_schema()](https://docs.databricks.com/aws/en/sql/language-manual/functions/current_schema.md)                                                                     | Returns the current schema.                                                                                                                                                                        |
| [current\_user()](https://docs.databricks.com/aws/en/sql/language-manual/functions/current_user.md)                                                                         | Returns the user executing the statement.                                                                                                                                                          |
| [current\_version()](https://docs.databricks.com/aws/en/sql/language-manual/functions/current_version.md)                                                                   | Returns the current version of Databricks.                                                                                                                                                         |
| [decode(expr, \{ key, value } \[, …\] \[,defValue\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/decode.md)                                           | Returns the value matching the key.                                                                                                                                                                |
| [elt(index, expr1 \[, …\] )](https://docs.databricks.com/aws/en/sql/language-manual/functions/elt.md)                                                                       | Returns the nth expression.                                                                                                                                                                        |
| [equal\_null(expr1, expr2)](https://docs.databricks.com/aws/en/sql/language-manual/functions/equal_null.md)                                                                 | Returns `true` if `expr1` equals `expr2` or both expressions are `NULL`, or `false` otherwise.                                                                                                     |
| [event\_log( \{ TABLE(table) \| pipeline\_id } )](https://docs.databricks.com/aws/en/sql/language-manual/functions/event_log.md)                                            | Returns a table of the refresh history for a materialized view, streaming table, or pipeline.                                                                                                      |
| [greatest(expr1, expr2 \[, …\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/greatest.md)                                                              | Returns the largest value of all arguments, skipping null values.                                                                                                                                  |
| [grouping(col)](https://docs.databricks.com/aws/en/sql/language-manual/functions/grouping.md)                                                                               | Indicates whether a specified column in a `GROUPING SET`, `ROLLUP`, or `CUBE` represents a subtotal.                                                                                               |
| [grouping\_id(\[col1 \[, …\]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/grouping_id.md)                                                           | Returns the level of grouping for a set of columns.                                                                                                                                                |
| [hash(expr1 \[, …\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/hash.md)                                                                             | Returns a hashed value of the arguments.                                                                                                                                                           |
| [hll\_sketch\_estimate(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/hll_sketch_estimate.md)                                                      | Estimates number of distinct values collected in a HyperLogLog sketch.                                                                                                                             |
| [hll\_union(expr1, expr2 \[,allowDifferentLgConfigK\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/hll_union.md)                                      | Combines two HyperLogLog sketches.                                                                                                                                                                 |
| [http\_request(\{parm => expr} \[, …\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/http_request.md)                                                  | Makes an HTTP request using a defined HTTP connection.                                                                                                                                             |
| [java\_method(class, method\[, arg1 \[, …\]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/java_method.md)                                            | Calls a method with reflection.                                                                                                                                                                    |
| [if(cond, expr1, expr2)](https://docs.databricks.com/aws/en/sql/language-manual/functions/if.md)                                                                            | Returns `expr1` if `cond` is `true`, or `expr2` otherwise.                                                                                                                                         |
| [iff(cond, expr1, expr2)](https://docs.databricks.com/aws/en/sql/language-manual/functions/iff.md)                                                                          | Returns `expr1` if `cond` is `true`, or `expr2` otherwise.                                                                                                                                         |
| [ifnull(expr1, expr2)](https://docs.databricks.com/aws/en/sql/language-manual/functions/ifnull.md)                                                                          | Returns `expr2` if `expr1` is `NULL`, or `expr1` otherwise.                                                                                                                                        |
| [input\_file\_block\_length()](https://docs.databricks.com/aws/en/sql/language-manual/functions/input_file_block_length.md)                                                 | Returns the length in bytes of the block being read.                                                                                                                                               |
| [input\_file\_block\_start()](https://docs.databricks.com/aws/en/sql/language-manual/functions/input_file_block_start.md)                                                   | Returns the start offset in bytes of the block being read.                                                                                                                                         |
| [input\_file\_name()](https://docs.databricks.com/aws/en/sql/language-manual/functions/input_file_name.md)                                                                  | Returns the name of the file being read, or empty string if not available.                                                                                                                         |
| [is\_account\_group\_member(group)](https://docs.databricks.com/aws/en/sql/language-manual/functions/is_account_group_member.md)                                            | Returns true if the current user is a member of group at the account level.                                                                                                                        |
| [is\_member(group)](https://docs.databricks.com/aws/en/sql/language-manual/functions/is_member.md)                                                                          | Returns true if the current user is a member of group at the workspace level.                                                                                                                      |
| [isnull(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/isnull.md)                                                                                  | Returns `true` if `expr` is `NULL`.                                                                                                                                                                |
| [isnotnull(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/isnotnull.md)                                                                            | Returns `true` if `expr` is not `NULL`.                                                                                                                                                            |
| [least(expr1, expr2 \[, …\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/least.md)                                                                    | Returns the smallest value of all arguments, skipping null values.                                                                                                                                 |
| [list\_secrets(\[scopeStr\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/list_secrets.md)                                                             | Returns the keys in all or one scope which the user is authorized to see from [Databricks secret service](https://docs.databricks.com/aws/en/security/secrets/index.md).                           |
| [luhn\_check(numStr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/luhn_check.md)                                                                       | Returns `true` if `numStr` passes the [Luhn algorithm](https://en.wikipedia.org/wiki/Luhn_algorithm) check.                                                                                        |
| [monotonically\_increasing\_id()](https://docs.databricks.com/aws/en/sql/language-manual/functions/monotonically_increasing_id.md)                                          | Returns monotonically increasing 64-bit integers.                                                                                                                                                  |
| [nullif(expr1, expr2)](https://docs.databricks.com/aws/en/sql/language-manual/functions/nullif.md)                                                                          | Returns `NULL` if `expr1` equals `expr2`, or `expr1` otherwise.                                                                                                                                    |
| [nvl(expr1, expr2)](https://docs.databricks.com/aws/en/sql/language-manual/functions/nvl.md)                                                                                | Returns `expr2` if `expr1` is `NULL`, or `expr1` otherwise.                                                                                                                                        |
| [nvl2(expr1, expr2, expr3)](https://docs.databricks.com/aws/en/sql/language-manual/functions/nvl2.md)                                                                       | Returns `expr2` if `expr1` is not `NULL`, or `expr3` otherwise.                                                                                                                                    |
| [raise\_error(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/raise_error.md)                                                                       | Throws an exception with `expr` as the message.                                                                                                                                                    |
| [range(end)](https://docs.databricks.com/aws/en/sql/language-manual/functions/range.md)                                                                                     | Returns a table of values within a specified range.                                                                                                                                                |
| [range(start, end \[, step \[, numParts\]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/range.md)                                                    | Returns a table of values within a specified range.                                                                                                                                                |
| [reflect(class, method\[, arg1 \[, …\]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/reflect.md)                                                     | Calls a method with reflection.                                                                                                                                                                    |
| [secret(scope, key)](https://docs.databricks.com/aws/en/sql/language-manual/functions/secret.md)                                                                            | Extracts a secret value with the given `scope` and `key` from [Databricks secret service](https://docs.databricks.com/aws/en/security/secrets/index.md).                                           |
| [session\_user()](https://docs.databricks.com/aws/en/sql/language-manual/functions/session_user.md)                                                                         | Returns the user connected to Databricks.                                                                                                                                                          |
| [spark\_partition\_id()](https://docs.databricks.com/aws/en/sql/language-manual/functions/spark_partition.md)                                                               | Returns the current partition ID.                                                                                                                                                                  |
| [sql\_keywords()](https://docs.databricks.com/aws/en/sql/language-manual/functions/sql_keywords.md)                                                                         | Returns the set of SQL keywords in Databricks.                                                                                                                                                     |
| [stack(numRows, expr1 \[, …\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/stack.md)                                                                  | Separates `expr1`, …, `exprN` into `numRows` rows.                                                                                                                                                 |
| [table\_changes(table\_str, start \[, end\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/table_changes.md)                                            | Returns a log of changes to a Delta Lake table with Change Data Feed enabled.                                                                                                                      |
| [theta\_difference(first, second)](https://docs.databricks.com/aws/en/sql/language-manual/functions/theta_difference.md)                                                    | Computes the set difference (A minus B) of two Theta Sketch binary representations.                                                                                                                |
| [theta\_intersection(first, second)](https://docs.databricks.com/aws/en/sql/language-manual/functions/theta_intersection.md)                                                | Computes the set intersection of two Theta Sketch binary representations.                                                                                                                          |
| [theta\_sketch\_estimate(sketch)](https://docs.databricks.com/aws/en/sql/language-manual/functions/theta_sketch_estimate.md)                                                | Returns the estimated number of unique values from a Theta Sketch binary representation.                                                                                                           |
| [theta\_union(first, second \[,lgNomEntries\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/theta_union.md)                                            | Merges exactly two Theta Sketch binary representations using set union.                                                                                                                            |
| [tuple\_difference\_double(first, second)](https://docs.databricks.com/aws/en/sql/language-manual/functions/tuple_difference_double.md)                                     | Computes the set difference (A minus B) of two TupleSketch binary representations with double summaries.                                                                                           |
| [tuple\_difference\_integer(first, second)](https://docs.databricks.com/aws/en/sql/language-manual/functions/tuple_difference_integer.md)                                   | Computes the set difference (A minus B) of two TupleSketch binary representations with integer summaries.                                                                                          |
| [tuple\_difference\_theta\_double(first, second)](https://docs.databricks.com/aws/en/sql/language-manual/functions/tuple_difference_theta_double.md)                        | Computes the set difference (A minus B) of a TupleSketch with double summaries and a Theta Sketch.                                                                                                 |
| [tuple\_difference\_theta\_integer(first, second)](https://docs.databricks.com/aws/en/sql/language-manual/functions/tuple_difference_theta_integer.md)                      | Computes the set difference (A minus B) of a TupleSketch with integer summaries and a Theta Sketch.                                                                                                |
| [tuple\_intersection\_double(first, second \[, mode \])](https://docs.databricks.com/aws/en/sql/language-manual/functions/tuple_intersection_double.md)                     | Computes the set intersection of exactly two TupleSketch binary representations with double summaries.                                                                                             |
| [tuple\_intersection\_integer(first, second \[, mode \])](https://docs.databricks.com/aws/en/sql/language-manual/functions/tuple_intersection_integer.md)                   | Computes the set intersection of exactly two TupleSketch binary representations with integer summaries.                                                                                            |
| [tuple\_intersection\_theta\_double(first, second \[, mode \])](https://docs.databricks.com/aws/en/sql/language-manual/functions/tuple_intersection_theta_double.md)        | Computes the set intersection of a TupleSketch with double summaries and a Theta Sketch.                                                                                                           |
| [tuple\_intersection\_theta\_integer(first, second \[, mode \])](https://docs.databricks.com/aws/en/sql/language-manual/functions/tuple_intersection_theta_integer.md)      | Computes the set intersection of a TupleSketch with integer summaries and a Theta Sketch.                                                                                                          |
| [tuple\_sketch\_estimate\_double(sketch)](https://docs.databricks.com/aws/en/sql/language-manual/functions/tuple_sketch_estimate_double.md)                                 | Returns the estimated number of unique keys from a TupleSketch with double summaries.                                                                                                              |
| [tuple\_sketch\_estimate\_integer(sketch)](https://docs.databricks.com/aws/en/sql/language-manual/functions/tuple_sketch_estimate_integer.md)                               | Returns the estimated number of unique keys from a TupleSketch with integer summaries.                                                                                                             |
| [tuple\_sketch\_summary\_double(sketch \[, mode \])](https://docs.databricks.com/aws/en/sql/language-manual/functions/tuple_sketch_summary_double.md)                       | Aggregates the summary values from a TupleSketch with double summaries.                                                                                                                            |
| [tuple\_sketch\_summary\_integer(sketch \[, mode \])](https://docs.databricks.com/aws/en/sql/language-manual/functions/tuple_sketch_summary_integer.md)                     | Aggregates the summary values from a TupleSketch with integer summaries.                                                                                                                           |
| [tuple\_sketch\_theta\_double(sketch)](https://docs.databricks.com/aws/en/sql/language-manual/functions/tuple_sketch_theta_double.md)                                       | Returns the theta value (sampling rate) from a TupleSketch with double summaries.                                                                                                                  |
| [tuple\_sketch\_theta\_integer(sketch)](https://docs.databricks.com/aws/en/sql/language-manual/functions/tuple_sketch_theta_integer.md)                                     | Returns the theta value (sampling rate) from a TupleSketch with integer summaries.                                                                                                                 |
| [tuple\_union\_double(first, second \[, lgNomEntries \[, mode \]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/tuple_union_double.md)                | Merges exactly two TupleSketch binary representations with double summaries using set union.                                                                                                       |
| [tuple\_union\_integer(first, second \[, lgNomEntries \[, mode \]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/tuple_union_integer.md)              | Merges exactly two TupleSketch binary representations with integer summaries using set union.                                                                                                      |
| [tuple\_union\_theta\_double(first, second \[, lgNomEntries \[, mode \]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/tuple_union_theta_double.md)   | Merges a TupleSketch with double summaries and a Theta Sketch using set union.                                                                                                                     |
| [tuple\_union\_theta\_integer(first, second \[, lgNomEntries \[, mode \]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/tuple_union_theta_integer.md) | Merges a TupleSketch with integer summaries and a Theta Sketch using set union.                                                                                                                    |
| [try\_reflect(class, method\[, arg1 \[, …\]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_reflect.md)                                            | Calls a method with reflection, returning `NULL` if the method fails.                                                                                                                              |
| [try\_secret(scope, key)](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_secret.md)                                                                   | Extracts a secret value with the given `scope` and `key` from [Databricks secret service](https://docs.databricks.com/aws/en/security/secrets/index.md), or `NULL` if the key cannot be retrieved. |
| [typeof(expr)](https://docs.databricks.com/aws/en/sql/language-manual/functions/typeof.md)                                                                                  | Return a DDL-formatted type string for the data type of `expr`.                                                                                                                                    |
| [user()](https://docs.databricks.com/aws/en/sql/language-manual/functions/user.md)                                                                                          | Returns the user executing the statement.                                                                                                                                                          |
| [user\_identity\_attribute\_values(principal, attributeName)](https://docs.databricks.com/aws/en/sql/language-manual/functions/user_identity_attribute_values.md)           | Returns the values of an identity attribute of the session user.                                                                                                                                   |
| [uuid()](https://docs.databricks.com/aws/en/sql/language-manual/functions/uuid.md)                                                                                          | Returns an universally unique identifier (UUID) string.                                                                                                                                            |
| [version()](https://docs.databricks.com/aws/en/sql/language-manual/functions/version.md)                                                                                    | Returns the Apache Spark version.                                                                                                                                                                  |
| [window(expr, width\[, step \[, start\]\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/window.md)                                                     | Creates a hopping based sliding-window over a timestamp expression.                                                                                                                                |
| [xxhash64(expr1 \[, …\])](https://docs.databricks.com/aws/en/sql/language-manual/functions/xxhash64.md)                                                                     | Returns a 64-bit hashed value of the arguments.                                                                                                                                                    |
