ID EN
String Functions and Operators

ELT(N,str1,str2,str3,...)

MySQL 8.4

ELT() returns the Nth element of the list of strings: str1 if N = 1, str2 if N = 2, and so on. Returns NULL if N is less than 1, greater than the number of arguments, or NULL. ELT() is the complement of FIELD().

Syntax

MYSQL
SELECT ELT(1, 'Aa', 'Bb', 'Cc', 'Dd');
'Aa'
SELECT ELT(4, 'Aa', 'Bb', 'Cc', 'Dd');
'Dd'

Examples

Example
MYSQL
SELECT ELT(1, 'Aa', 'Bb', 'Cc', 'Dd');
'Aa'
SELECT ELT(4, 'Aa', 'Bb', 'Cc', 'Dd');
'Dd'