Home > Database > Mysql Tutorial > body text

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

WBOY
Release: 2023-09-16 09:53:02
forward
1116 people have browsed it

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)
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!