Home  >  Article  >  Database  >  How to perform hexadecimal conversion in mysql

How to perform hexadecimal conversion in mysql

青灯夜游
青灯夜游Original
2022-01-04 16:18:335165browse

mysql decimal conversion method: 1. Use "bin(value)" to convert decimal to binary; 2. Use "oct(value)" to convert decimal to octal; 3. Use " hex(value)", you can convert decimal to hexadecimal; 4. Use "conv('value',2,10)" to convert binary to decimal.

How to perform hexadecimal conversion in mysql

The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.

Conversion between mysql decimals

1. Convert decimal to binary

select bin(5);

2. Convert decimal to octal

select oct(5);

3. Convert decimal to hexadecimal

select hex(5);

4. Convert binary to decimal

select conv('101',2,10);

5. Convert decimal to hexadecimal

select conv('20',10,16);

[Related recommendations: mysql video tutorial]

The above is the detailed content of How to perform hexadecimal conversion in mysql. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn