What MySQL returns if we convert an empty hexadecimal value to a number?


As we know that an empty hexadecimal value is a zero-length binary string hence if 0 is added to it then the result would be 0. In other words, we can say that if we convert an empty hexadecimal value to a number then it produces 0. The following query will make it understand −

mysql> SELECT X''+ 0;
+--------+
| X''+ 0 |
+--------+
| 0      |
+--------+
1 row in set (0.15 sec)

Rishi Raj
Rishi Raj

I am a coder

Updated on: 20-Jun-2020

49 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements