What MySQL ELT() function returns if the index number, provided as an argument, is higher than the number of strings?

MySQLMySQLi Database

MySQL ELT() function returns NULL as output if the index number provided as argument is higher than the number of strings. Following is an example to make it clearer −


mysql> Select ELT(6,'Ram','is','a','good','boy')As Result;
| Result |
| NULL   |
1 row in set (0.00 sec)

As we can see that index number is 6 and the list of strings is having only 5 strings. Hence MySQL returns NULL.

Updated on 20-Jun-2020 08:48:29