D/MySQL

[MySQL] ELT()

yeon.Biju 2020. 4. 8. 14:34

MySQL 문자열 함수와 연산자

 

ELT()

   - 

 

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

의 형태

 

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

 

mysql> SELECT ELT(1, 'A', 'B', 'C');
+-----------------------+
| ELT(1, 'A', 'B', 'C') |
+-----------------------+
| A                     |
+-----------------------+
1 row in set (0.00 sec)

 

mysql> SELECT ELT(4, 'A', 'B', 'C');
+-----------------------+
| ELT(4, 'A', 'B', 'C') |
+-----------------------+
| NULL                  |
+-----------------------+
1 row in set (0.00 sec)