Syntax:
HEX(N_or_S)

If N_or_S is a number, returns a string representation of the
hexadecimal value of N, where N is a longlong (BIGINT) number. This is
equivalent to CONV(N,10,16).

If N_or_S is a string, returns a hexadecimal string representation of
N_or_S where each character in N_or_S is converted to two hexadecimal
digits. The inverse of this operation is performed by the UNHEX()
function.

URL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html

