What is BIN() in SQL?
The BIN() function returns a binary representation of the decimal value, given as a parameter, in the form of a string.
Figure 1 shows a visual representation of the BIN() function.
Syntax
BIN(value)
Parameter
The BIN() function takes the decimal value as a parameter.
Return value
The BIN() function returns a binary representation of the decimal value sent as a parameter in the string form.
It returns
NULLif thedecimal valueisNULL.
Example
-- simple numberSELECT BIN(11);SELECT BIN(100);-- NULLSELECT BIN(NULL);