MYSQL Tutorial

MySQL BIN() function

BIN() function

MySQL BIN() returns the corresponding string representation of the binary value of a BIGINT number. It returns NULL if the number is NULL. The equivalent of BIN() is CONV(N,10,2), where N is a BIGINT number.




Name Description
num1 A number whose BINARY value is to be retrieved.

Syntax Diagram:

MySQL BIN() Function - Syntax Diagram

MySQL Version: 5.6

Video Presentation

Example: MySQL BIN() function

The following MySQL statement returns the string representation of 255, i.e. '11111111'.



Sample Output:

mysql> SELECT BIN(255);
| BIN(255) |
| 11111111 | 
1 row in set (0.01 sec)

All String Functions

MySQL String Functions, slide presentation

Many of our valued users post comments along with piece of code. Disqus may, false positively, consider those piece of code as Bad or Starnge syntax and send those comments to spam automatically. Even if that happens, we will make sure those useful comments are taken out of spam and approved. It may take a couple of days for that though, but any useful comment will be brought to public view for sure. We regret if that happend to any user. You may write us directly regarding this to - w3resource[at]yahoo[dot]com.