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

# `vector_norm` function

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

Computes the Lp norm of a vector using the specified degree.

## Syntax

```
vector_norm(vector [, degree ])
```

## Arguments

* **vector**: An `ARRAY<FLOAT>` expression representing the vector.
* **degree**: Optional. A `FLOAT` value specifying the norm type; defaults to 2.0 (Euclidean norm). Supported values:
  * 1.0 — L1 norm (Manhattan): sum of absolute values
  * 2.0 — L2 norm (Euclidean): square root of sum of squares
  * `float('inf')` — L∞ (infinity norm): maximum absolute value

## Returns

A `FLOAT` value representing the norm of the vector. The result is non-negative.

Returns 0.0 for empty vectors. Returns `NULL` if the input is `NULL` or contains `NULL`.

## Notes

* Only `ARRAY<FLOAT>` is supported; other types such as `ARRAY<DOUBLE>` or `ARRAY<DECIMAL>` raise an error. An unsupported `degree` value raises [INVALID\_VECTOR\_NORM\_DEGREE](https://docs.databricks.com/aws/en/error-messages/error-classes.md#invalid_vector_norm_degree).
* L2 norm is the most common in dense embedding workloads; L1 is used in sparse and probabilistic applications; L∞ is used in worst-case analysis.

## Error conditions

* [INVALID\_VECTOR\_NORM\_DEGREE](https://docs.databricks.com/aws/en/error-messages/error-classes.md#invalid_vector_norm_degree)

## Examples

```sql
-- L2 norm (Euclidean) - classic 3-4-5 triangle
> SELECT vector_norm(array(3.0f, 4.0f), 2.0f);
  5.0

-- L1 norm (Manhattan)
> SELECT vector_norm(array(3.0f, 4.0f), 1.0f);
  7.0

-- L∞ norm (infinity)
> SELECT vector_norm(array(3.0f, 4.0f), float('inf'));
  4.0

-- Empty vector returns 0.0
> SELECT vector_norm(array(), 2.0);
  0.0
```

## Related functions

* [`vector_normalize` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/vector_normalize.md)
* [`vector_cosine_similarity` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/vector_cosine_similarity.md)
* [`vector_inner_product` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/vector_inner_product.md)
* [`vector_l2_distance` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/vector_l2_distance.md)
