left()

Scalar. Returns a specified number of characters from the beginning of a given string.

Syntax

left ( string, count )

Parameters

string

A string.

count

The number of characters to return.

Usage

Returns a specified number of characters from the beginning of a given string. The function takes a string and an integer as the count argument. The function returns a string. If count is a negative number, the function returns NULL. If count is 0, the function returns an empty string.

The function works with UTF-8 strings if the -U server option is specified.

Example

left ('examplestring', 7) returns 'example'.