What is MySQL ELT() function?

MySQL ELT() function returns the string which is at index number specified in the argument list. The first argument would be the index of the string to be retrieved from the argument list.


ELT(index number, str1, str2,…,strN)

Here index number is an integer and it is the index of the string to be retrieved. And str1, str2 ,…, strN are the strings among which the search would happen.


mysql> Select ELT(4,'Ram','is','a','good','boy')As Result;

| Result |
| good   |

1 row in set (0.00 sec)

From the above example, we can see that ELT() returns ‘good’ as output because it is at index 4 in the list of strings and we provided 4 as the first argument.

Rishi Raj
Rishi Raj

I am a coder