MySQL数据库中有一个不太常用但便于进行某些调试的函数:sleep(),今天我们就来介绍一下这个函数的用法. 首先,看看官网对于函数的定义: SLEEP(duration)Sleeps (pauses) for the number of seconds given by the duration argument, then returns 0. The duration may have a fractional part. If the argument is NULL or negat…
Cast函数:CONVERT函数. 用法:CAST(expr AS type), CONVERT(expr,type) , CONVERT(expr USING transcoding_name). SELECT CONVERT('abc' USING utf8); 将varchar 转为Int 用 cast(str as unsigned) str为varchar类型的字符串 . 比如常用的百分比转换: select cast((1/3)*100 as UNSIGNED) as percent…