Step by step mysql tutorials
Hex() function returns a hexadecimal representation of decimal or string value.
N
treated as a longlong (BIGINT) number. This is equivalent to
CONV(HEX(N),16,10). The inverse of this operation is performed by CONV(HEX(N),16,10).[table caption=”” width=”100%” colwidth=”15%|30%|55%” colalign=”left|left|left”]
Name, Required /Optional, Description
string1, Required, It represents input as a string.
N, Numeric, It represents input as a number.
[/table]
[table caption=”” width=”100%” colwidth=”20%|80%” colalign=”left|left”]
Returns, hexadecimal representation of decimal or string value.
[/table]
[table caption=”” width=”100%” colwidth=”25%|75%” colalign=”left|left”]
Version, MySQL 5.7
[/table]
mysql> SELECT HEX(200); +----------+ | HEX(200) | +----------+ | C8 | +----------+ 1 row in set (0.00 sec)
Shows string as input.
mysql> SELECT X'74757473', HEX('tuts'), UNHEX(HEX('tuts')); +-------------+-------------+--------------------+ | X'74757473' | HEX('tuts') | UNHEX(HEX('tuts')) | +-------------+-------------+--------------------+ | tuts | 74757473 | tuts | +-------------+-------------+--------------------+ 1 row in set (0.00 sec)
Shows numbers as input. As, u can see in this example, UNHEX() doesn’t inverse HEX() numeric values.
mysql> SELECT HEX(155), CONV(HEX(155),16,10) , unhex(hex(155)); +----------+----------------------+-----------------+ | HEX(155) | CONV(HEX(155),16,10) | unhex(hex(155)) | +----------+----------------------+-----------------+ | 9B | 155 | � | +----------+----------------------+-----------------+ 1 row in set (0.00 sec)
See all MySQL String functions MySQL 8 String Functions.
In the digital age, the way we experience childhood has changed, but the essence remains the same—imagination, exploration, and joy.…
Looking for the perfect toy for your child can feel overwhelming with so many choices in today’s market. Whether you're…
In the heart of every child lies a world bursting with imagination — and the key to unlocking that world…
In the fast-paced world of growing cities and digital lifestyles, children need spaces where their imagination is free to roam.…
In a city as vibrant and diverse as Delhi, there’s a magic that lives beyond the monuments, food stalls, and…
In the vibrant and rapidly developing city of Noida, playtime is getting smarter, more imaginative, and more inclusive than ever…