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.
Syntax:
BIN(num1)
Argument:
Name | Description |
---|---|
num1 | A number whose BINARY value is to be retrieved. |
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'.
Code:
SELECT BIN(255);
Sample Output:
mysql> SELECT BIN(255); +----------+ | BIN(255) | +----------+ | 11111111 | +----------+ 1 row in set (0.01 sec)
All String Functions
Previous: ASCII
Next: BIT_LENGTH
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework