MariaDB: BIN Function
This MariaDB tutorial explains how to use the MariaDB BIN function with syntax and examples.
Description
The MariaDB BIN function converts a decimal number to a binary number and returns the result as a string value.
Syntax
The syntax for the BIN function in MariaDB is:
BIN( number )
Parameters or Arguments
- number
- The number to convert to a binary representation.
Note
- The BIN function returns the binary representation as a string value.
- The BIN function is equivalent to using the CONV function with CONV(number,10,2) syntax.
Applies To
The BIN function can be used in the following versions of MariaDB:
- MariaDB 10
Example
Let's look at some MariaDB BIN function examples and explore how to use the BIN function in MariaDB.
For example:
SELECT BIN(3); Result: '11' SELECT BIN(4); Result: '100' SELECT BIN(5); Result: '101' SELECT BIN(21); Result: '10101'
Advertisements