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

# `ltrim` 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 `str` with leading characters within `trimStr` removed.

## Syntax

```
ltrim( [trimstr ,] str)
```

## Arguments

* `trimstr`: An optional `STRING` expression with the string to be trimmed.
* `str`: A `STRING` expression from which to trim.

## Returns

A `STRING`.

The default for `trimStr` is a single space.
The function removes any leading characters within `trimStr` from `str`.

## Examples

```sql
> SELECT '+' || ltrim('    SparkSQL   ') || '+';
 +SparkSQL   +

> SELECT '+' || ltrim('abc', 'acbabSparkSQL   ') || '+';
 +SparkSQL   +

> SELECT '+' || ltrim('ABC' COLLATE UTF8_BINARY, 'acbabSparkSQL   ') || '+';
 +acbabSparkSQL   +

> SELECT '+' || ltrim('ABC' COLLATE UTF8_LCASE, 'acbabSparkSQL   ') || '+';
 +SparkSQL   +
```

## Related functions

* [`rpad` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/rpad.md)
* [`lpad` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/lpad.md)
* [`rtrim` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/rtrim.md)
* [`trim` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/trim.md)
