Skip to content

BIN

  • n: This is an integral number that will be converted to binary. For example, BIN(12) will return ‘1100’, representing the binary form of the number 12.
SELECT BIN(12);
'1100'

The BIN() function in MySQL is used to convert a decimal number to binary. In the provided example, the decimal number 12 is converted to binary, resulting in ‘1100’.