MySQL BIN() Function
In MySQL, the BIN()
function return a string representation of the binary value of a given number.
BIN()
Syntax
Here is the syntax of MySQL BIN()
function:
BIN(number)
Parameters
number
- Required. A long long number that is
BIGINT
.
Return value
The BIN()
function returns a string that represents the binary value of the given number.
The BIN()
function will return NULL
if the argument number
is NULL
.
BIN()
Examples
SELECT
BIN(2),
BIN(5),
BIN(18),
BIN(186),
BIN(1.5),
BIN(3.6),
BIN('A'),
BIN('3A'),
BIN(NULL)\G
BIN(2): 10
BIN(5): 101
BIN(18): 10010
BIN(186): 10111010
BIN(1.5): 1
BIN(3.6): 11
BIN('A'): 0
BIN('3A'): 11
BIN(NULL): NULL