Computer >> Computer tutorials >  >> Programming >> MySQL

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


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 −

Example

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.