MySQL内置函数-单行函数(进制换算函数)
进制换算
conv(n,from_base,to_base)
例如: mysql> select conv("a",16,2); --意思就是 将16进制的‘a’转换成2进制的 +----------------+ | conv("a",16,2) | +----------------+ | 1010 | +----------------+ 1 row in set (0.00 sec)
mysql> select ascii(‘a‘); +------------+ | ascii(‘a‘) | +------------+ | 97 | +------------+ 1 row in set (0.00 sec) mysql> select bin(10); +---------+ | bin(10) | +---------+ | 1010 | +---------+ 1 row in set (0.00 sec) mysql> select oct(10); +---------+ | oct(10) | +---------+ | 12 | +---------+ 1 row in set (0.00 sec) mysql> select hex(10); +---------+ | hex(10) | +---------+ | A | +---------+ 1 row in set (0.00 sec)
char(n,...) 返回由参数n,...对应的ascii代码字符组成的一个字串(参数是n,...是数字序列,null值被跳过)
mysql> select char(77,121,83,81,‘76‘); +-------------------------+ | char(77,121,83,81,‘76‘) | +-------------------------+ | MySQL | +-------------------------+ 1 row in set (0.00 sec) mysql> select char(77,77.5,‘77.3‘); +----------------------+ | char(77,77.5,‘77.3‘) | +----------------------+ | MNM | +----------------------+ 1 row in set, 1 warning (0.00 sec)
相关推荐
sddfsAv 2020-04-11
渴望就奋力追寻 2020-01-28
风吹夏天 2020-01-10
tterminator 2014-03-13
86417618 2012-05-28
xiongxu 2019-06-12
Poem 2011-09-26
arctan0 2016-03-09
人亦有言进退维谷 2010-11-16
把握自己 2016-06-26
jling 2019-06-28
lbcmail 2019-06-28
ifconfig 2016-03-22
wufan0 2019-06-21
ReDisaster 2019-06-21
ahansban 2008-05-30