字符串函数

concat(s1,s2,...) 字符串拼接

upper(str)

lower(str)

lpad(str,n,pad)

rpad(str,n,pad)

trim(str)

substring(str,start,len);

数值函数

ceil 向上取整

floor向下取整

mod 取模,余数

rand 随机生成0-1

round 四舍五入,小数四舍五入,规定多少位小数

日期函数

curdata() 当前日期

curtime()当前时间

now() 当前日期时间

year(data) 获取给出的时间的年分

month(data)获取给出的时间的月份

day(data)获取给出的时间的当日

data_add(data,INTERVAL count d) 给出时间叠加之后的时间

datadiff(data1,data2) 时间间隔天数

流程函数

IF(value,tt,ff) 如果value为ture,返回tt否则返回ff

IFNULL(value1,value2) 如果value1不为空返回value1,否则返回value2

case when value1 then value2