您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

MySQL数据库函数

2024/6/13 14:39:28发布41次查看
一:字符串函数:
1.concat();
concat(s1,s2,s3,......sn);
把传入参数链接成一个字符串;
2.insert();
insert(str,x,y,insert);
st r: 传入的字符串,
x  : 从第几个开始
y  :需要替换几个字符
insert : 替换的字符串
3.lower(), upper()
lower():  字符串转为大写;
upper(): 字符串转为小写;
4.left(str,x)  right(str,y)
str :需要返回的字符串
x : 返回多少个字符
5.rpad(str,n,pad)
str  :需要填充的字符
n     :填充后字符串的长度
pad  :需要填充的字符
6.trime()
去掉字符串两边的空格
7.replace(str,a,b)
str :需要替换的字符串
用字符串b去替换str中的a
8.strcmp(s1,s2)
如果s1大于s2返回1
如果s1小于s2返回-1
如果s1等于s2返回0
9.substring(str,x,y)
str :需要返回的字符串
x   :从第x位置开始
y   :取y个字符
二:数值函数:
1.abs(x)     返回x的绝对值
2.ceil(x) 返回大于x的最小值
3.floor(x)    返回小于x的最大值
4.med(x,y) 返回x,y的摸(求余)
5.rand()      返回随机数
6.round(x,y)     返回x的四舍五入的y位置的值(四舍五入)
7.truncate(x,y)  返回数字x截断为y的小数结果;
三:时间函数:
1.curdate() 返回当前日期 2014-7-4
2.curtime() 返回当前时间 12:00:01
3.now() 返回当前时间 2014-7-4 12:00:01
4.unix-time(now()) 返回当前时间戳  1293433835
5.time()  时间戳转化 time(1293433835)
6.week()   返回当前星期几
7.data_format()格式化当前时间    date_format(now(),'%b %d %y %h:%i %p')  dec 29 2008 11:45 pm
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product