Description
The LEFT( ) function returns the leftmost character of a string (str). If the string is NULL, then it returns NULL.
This function has the form:
SELECT LEFT(str, len)
Parameter | Description |
---|---|
str | A string |
len | Length |
Return Value
The leftmost character of a string (str). If the string is NULL, then it returns NULL.
Examples
The following example shows the basic use of this function:
mysql> SELECT LEFT('foobarbar', 5);
-> 'fooba'