## CONV( )

This MySQL function converts a number from one numeric base system to another.

### Syntax

Below is the syntax for this command. Text within square brackets (i.e, [ and ] ) are optional. Choices are separated by bars (i.e, | ). Ellipses preceded by a comma indicates a repeating pattern. Ellipses before or after syntax are used to highlight a relevant except from the larger syntax. Text displayed in italic letters represent text that should be replaced with the specific names related to the database (e.g., *column* with the name of the column).

CONV(number,from_base,to_base)

### Explanation

This function converts a number from one numeric base system to another. The number to convert is given in the first argument, the base from which to convert the number in the second, and the base to which to convert the number in the third. The minimum base allowed is 2 and the maximum is 36.

### Examples

SELECT CONV(4, 10, 2) AS 'Base-10 4 Converted', CONV(100, 2, 10) AS 'Binary 100 Converted'; +---------------------+----------------------+ | Base-10 4 Converted | Binary 100 Converted | +---------------------+----------------------+ | 100 | 4 | +---------------------+----------------------+

Here the number 4 under the base 10 system is converted to the base-two or binary equivalent and back again.