left function (Databricks SQL)

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

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