Jump to: navigation, search

Mysql MAKE SET

From w3cyberlearnings

Contents

MySQL MAKE_SET Function

This functions returns a set of value consist of the strings that have the corresponding bit. Str1=0, Str2=1, and so on. Null value is in Str1.

Syntax MAKE_SET

  • bits: bite set for str1,str2,..
  • str1: for bit sets 0
  • str2: for bit sets 1
MAKE_SET(bits, str1, str2,..);

Example 1

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

Example 2

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


Example 3

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

Related Links


Navigation
Web
SQL
MISC
References