bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/SQL/SQL References
SQL•SQL References

MySQL CONV() Function

Concept visual

MySQL CONV() Function

Pointer walk
two pointers
leftright102132436485116
left=0
right=6
1
3

Start at both ends

Example

Convert a number from numeric base system 10 to numeric base system 2: SELECT CONV(15,

10, 2);

Definition and Usage

The CONV() function converts a number from one numeric base system to another, and returns the result as a string value.

Note:

This function returns NULL if any of the parameters are NULL.

Tip:

Also look at the BIN() function.

Syntax

Conv(

number, from_base, to_base )

Parameter Values

Parameter

Description number

Required. A number from_base

The numeric base system of number

(a number between 2 and 36) to_base The numeric base system to convert to (a number between 2 and 36 or

Formula

- 2 and - 36)

Technical Details

Works in:

From MySQL 4.0

More Examples

Example

Convert a number from numeric base system 2 to numeric base system 10:

SELECT CONV(1111, 2, 10);

Example

Convert a number from numeric base system 10 to numeric base system 16:

SELECT CONV(88, 10, 16);

Previous

❮ MySQL Functions

Next

Previous

MySQL CONNECTION_ID() Function

Next

MySQL CONVERT() Function