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

# `left` function

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

Returns the leftmost `len` characters from `str`.

## Syntax

```
left(str, len)
```

## Arguments

* `str`: A STRING expression.
* `len`: An INTEGER expression.

## Returns

A STRING.

If `len` is less than 1, an empty string is returned.

## Examples

```sql
> SELECT left('Spark SQL', 3);
 Spa
```

## Related functions

* [`right` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/right.md)
* [`substr` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/substr.md)
