BIN
Descriptionβ
Converts decimal numbers to binary text.
Syntaxβ
BIN(<a>)
Parametersβ
Parameter | Description |
---|---|
<a> | Decimal value to be converted |
Return Valueβ
The binary representation of the parameter <a>
. When <a>
is negative, the result is its 64-bit complement.
Examplesβ
select bin(0);
+--------+
| bin(0) |
+--------+
| 0 |
+--------+
select bin(-1);
+------------------------------------------------------------------+
| bin(-1) |
+------------------------------------------------------------------+
| 1111111111111111111111111111111111111111111111111111111111111111 |
+------------------------------------------------------------------+
select bin(123);
+----------+
| bin(123) |
+----------+
| 1111011 |
+----------+