LEFT() FUNCTION in MySQL

LEFT() FUNCTION The MySQL LEFT function is used to extract a substring from a string. It starts the extraction from the left-most character. The various versions of MySQL support the LEFT function, namely, MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0 and MySQL 3.23.

Syntax:

LEFT( string, number_of_characters )

Parameters: string: It is used to specify the string to search. number_of_characters: It is used to specify the number of characters to extract from the string.

Example:

mysql> SELECT LEFT ( 'HELLO WORLD', 5);

Output:

'HELLO’

Explanation: The first five characters are extracted from the leftmost position of the string.

Please follow and like us:
Content Protection by DMCA.com