Converts a number from decimal (base 10) to binary (base 2).
SELECT CONV(15, 10, 2); |
The CONV() function converts a number from one numeric base system to another and outputs the result as a string.
Note: The CONV() function returns NULL if any of its parameters are NULL.
Tip: Additionally, consider using the BIN() function for specific binary conversions.
CONV(number, from_base, to_base) |
Parameter |
Description |
number |
Required: A numerical value |
from_base |
The numeric base system of the number (a value between 2 and 36) |
to_base |
The numeric base system to convert to (a value between 2 and 36 or -2 and -36) |
Works in: |
From MySQL version 4.0 |
Converts a number from binary (base 2) to decimal (base 10).
SELECT CONV(1111, 2, 10); |
Converts a number from decimal (base 10) to hexadecimal (base 16).
SELECT CONV(88, 10, 16); |