April 2008
Intermediate to advanced
566 pages
21h 55m
English
CONV()
CONV(number,from_base,to_base)
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. Here is an example:
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 2 or binary equivalent and back again.
Read now
Unlock full access