What is MySQL ELT() function?

MySQLMySQLi Database

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.

Syntax

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.

Example

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.

raja
Published on 20-Feb-2018 06:29:12
Advertisements