웹이야기

[MySQL] MAKE_SET() 본문

D/MySQL

[MySQL] MAKE_SET()

yeon.Biju 2020. 4. 14. 14:40

MySQL 문자열 함수와 연산자

 

MAKE_SET()

   -

 

MAKE_SET(bits, str1, str2, ...)

의 형태

 

Returns a set value(a string containing substrings separated by , characters) consisting of the strings that have the corresponding bit in bits set. str1 correspondes to bit 0, str2 to bit 1, and so on. NULL values in str1, str2, ... are not appended to the result.

 

mysql> SELECT MAKE_SET(1, 'a', 'b', 'c') ; 

+----------------------------+
| MAKE_SET(1, 'a', 'b', 'c') |
+----------------------------+
| a                          |
+----------------------------+
1 row in set (0.00 sec)

 

 

mysql> SELECT MAKE_SET(1 | 4, 'hello', 'nice', 'world') ;
+-------------------------------------------+
| MAKE_SET(1 | 4, 'hello', 'nice', 'world') |
+-------------------------------------------+
| hello,world                               |
+-------------------------------------------+
1 row in set (0.00 sec)

 


mysql> SELECT MAKE_SET(1 | 3, 'hello', 'nice',NULL, 'world') ;
+------------------------------------------------+
| MAKE_SET(1 | 3, 'hello', 'nice',NULL, 'world') |
+------------------------------------------------+
| hello,nice                                     |
+------------------------------------------------+

mysql> SELECT MAKE_SET(0, 'a', 'b', 'c') ;
+----------------------------+
| MAKE_SET(0, 'a', 'b', 'c') |
+----------------------------+
|                            |
+----------------------------+
1 row in set (0.00 sec)

 

 

 

 

'D > MySQL' 카테고리의 다른 글

[MySQL] OCT()  (0) 2020.04.14
[MySQL] MID()  (0) 2020.04.14
[MySQL] LTRIM()  (0) 2020.04.14
[MySQL] LPAD()  (0) 2020.04.14
[MySQL] LOWER()  (0) 2020.04.14
Comments