一千行MySQL学习笔记(十)
                        
                            时间:2021-07-01 10:21:17
                            帮助过:2人阅读
							                        
                     
                    
                    
                    -- 数值函数abs(x)            -- 绝对值 abs(-10.9) = 10format(x, d)    -- 格式化千分位数值 format(1234567.456, 2) = 1,234,567.46ceil(x)            -- 向上取整 ceil(10.1) = 11floor(x)        -- 向下取整 floor (10.1) = 10round(x)        -- 四舍五入去整mod(m, n)        -- m%n m mod n 求余 10%3=1pi()            -- 获得圆周率pow(m, n)        -- m^nsqrt(x)            -- 算术平方根rand()            -- 随机数truncate(x, d)    -- 截取d位小数-- 时间日期函数now(), current_timestamp();     -- 当前日期时间current_date();                    -- 当前日期current_time();                    -- 当前时间date(‘yyyy-mm-dd hh:ii:ss‘);    -- 获取日期部分time(‘yyyy-mm-dd hh:ii:ss‘);    -- 获取时间部分date_format(‘yyyy-mm-dd hh:ii:ss‘, ‘%d %y %a %d %m %b %j‘);    -- 格式化时间unix_timestamp();                -- 获得unix时间戳from_unixtime();                -- 从时间戳获得时间-- 字符串函数length(string)            -- string长度,字节char_length(string)        -- string的字符个数substring(str, position [,length])        -- 从str的position开始,取length个字符replace(str ,search_str ,replace_str)    -- 在str中用replace_str替换search_strinstr(string ,substring)    -- 返回substring首次在string中出现的位置concat(string [,...])    -- 连接字串charset(str)            -- 返回字串字符集lcase(string)            -- 转换成小写left(string, length)    -- 从string2中的左边起取length个字符load_file(file_name)    -- 从文件读取内容locate(substring, string [,start_position])    -- 同instr,但可指定开始位置lpad(string, length, pad)    -- 重复用pad加在string开头,直到字串长度为lengthltrim(string)            -- 去除前端空格repeat(string, count)    -- 重复count次rpad(string, length, pad)    --在str后用pad补充,直到长度为lengthrtrim(string)            -- 去除后端空格strcmp(string1 ,string2)    -- 逐字符比较两字串大小-- 流程函数case when [condition] then result [when [condition] then result ...] [else result] end   多分支if(expr1,expr2,expr3)  双分支。-- 聚合函数count()sum();max();min();avg();group_concat()-- 其他常用函数md5();default();
(未完待续) 
          (作者:Shocker 来源:http://www.cnblogs.com/shockerli/p/1000-plus-line-mysql-notes.html)
一千行MySQL学习笔记(十)
标签: