left function

Applies to: check marked yes Databricks SQL check marked yes 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

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