What is MySQL MAKE_SET() function?

MySQL MAKE_SET() function converts the decimal number in bits to binary and returns a set value(i.e. comma-separated list of values) for all bits that are set in that number using 1st string for the low-order bit, 2nd string for the next lowest bit and so on.


MAKE_SET(bits, str1, str2,…)


  • the bit is an expression, can have a decimal or binary value.
  • Str1, str2… is the list of strings.


mysql> Select MAKE_SET(1|2|4, 'Tutorials','Point','.com');

| MAKE_SET(1|2|4, 'Tutorials','Point','.com') |
| Tutorials,Point,.com                        |

1 row in set (0.00 sec)

Here, in the above example, first bit is 1 i.e. 001, the rightmost digit is 1 hence it returns ‘Tutorials’, second bit is 2 i.e. 010, the middle digit is 1 hence it returns ‘Point’ and third bit is 4 i.e. 100, the leftmost digit is 1 hence it returns ‘.com’.

Vikyath Ram
Vikyath Ram

A born rival