MID() FUNCTION in MySQL

MID() FUNCTION
The MySQL MID function is used to extract a substring from a string. The various versions of MySQL support the MID 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:

MID( string, start_position, length )

Parameters:
string: It is used to specify the string to search.
start_position: It is used to specify the position to begin extraction.
length: It is used to specify the number of characters to extract.

Example:

mysql> SELECT MID ( 'HELLO WORLD', 7, 5 );

Output:

‘WORLD’

Explanation:
The substring is extracted from the 7th position for 5 characters.