ELT() FUNCTION in MySQL

ELT() FUNCTION
The MySQL ELT function is used to extract the nth string from the list of strings.

Syntax:

ELT( n, string_1, string_2, … string_n );

Parameters:
n: It is used to specify the index of the string to extract.
string_1, string_2, … string_n: It is used to specify a list of strings.

Example:

mysql> SELECT ELT ( 2, ‘a’, ‘b’, ‘c’, ‘d’ );

Output:

‘b’

Explanation:
The 2nd element is extracted and returned from the list of strings.