MySQL CONV Function

MySQL CONV function is one of the Mathematical methods, which converts the user-specified expression for one base to another base. It returns the string as an output.

Let us see how to use this to convert the numbers from one base to another base with an example. This CONV function accepts the base value from 2 as a minimum to a maximum of 32. The syntax of this is as shown below:

SELECT CONV(N, from_base, to_base);

MySQL CONV Function Example

This MySQL method is used to convert the given values between different bases. The following Mathematical Function query shows multiple ways to use this one and the same can be applied to columns.

SELECT CONV(15, 10, 2), CONV(7, 10, 2);

SELECT CONV('a', 16, 2), CONV('f', 16, 2);

SELECT CONV('Hi', 18, 2), CONV('Hello', 18, 2);
CONV Function