Home  >  Article  >  Database  >  Which function in MySQL returns the same output as the BIN() function?

Which function in MySQL returns the same output as the BIN() function?

WBOY
WBOYforward
2023-09-16 09:53:021118browse

MySQL 中哪个函数返回与 BIN() 函数相同的输出?

As we all know, the BIN() function converts a number into a binary value and returns a binary string with DECIMAL as the base. In this way, it can be considered the same as the CONV(N,10,2) function. This means that the output of CONV(N,10,2) will be the same as the output of the BIN() function.

In the CONV(N,10,2) function, 'N' is the number to be executed. will be converted, 10 represents the base of N, which is DECIMAL, and 2 represents that we want to convert N to a binary string.

Example

The following example will demonstrate that the output of BIN() returns the same as CONV(N,10,2)

mysql> Select BIN(15);
+---------+
| BIN(15) |
+---------+
| 1111    |
+---------+
1 row in set (0.00 sec)

mysql> Select CONV(15,10,2);
+---------------+
| CONV(15,10,2) |
+---------------+
| 1111          |
+---------------+
1 row in set (0.00 sec)

The above is the detailed content of Which function in MySQL returns the same output as the BIN() function?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete