VeloDB Cloud
SQL Manual
Functions
math-functions
bin

bin

Description

Syntax:

STRING bin(BIGINT x)

This function converts the decimal number x to binary.

Example

mysql> select bin(0);
+--------+
| bin(0) |
+--------+
| 0      |
+--------+
mysql> select bin(10);
+---------+
| bin(10) |
+---------+
| 1010    |
+---------+
mysql> select bin(-3);
+------------------------------------------------------------------+
| bin(-3)                                                          |
+------------------------------------------------------------------+
| 1111111111111111111111111111111111111111111111111111111111111101 |
+------------------------------------------------------------------+

Keywords

BIN