mysql函数

Mysql函数

加密密码
select password(‘123456’);
md5加密密码(貌似mysql数据库相同密码每次加密后的md5字符串都是一样)
select md5(‘123456’);

select AES_ENCRYPT(‘123456’,’key’) ; #加密
select AES_DECRYPT( ( select AES_ENCRYPT(‘123456’,’key’) ),’key’) ; #解密

select encode(‘123456’,’qwedgnkh’); #加密
select decode(encode (“‘123456’”,“‘qwedgnkh’”),“‘qwedgnkh’”) #解密

select charset(‘string’),charset(convert(‘string’ using latin1)); #改变字串的默认字符集

使用数学函数rand()生成3个10以内的随机整数
select round(rand() * 10) , round(rand() * 10) , round(rand() * 10) ;

使用函数计算三角函数
select pi() ,sin( pi()/2 ) ,cos( pi() ),round( tan(pi()/4) ),floor( cot(pi()/4) );

获得当前日期+时间(date + time)函数:now()
select now() ;

获得当前时间戳函数
select current_timestamp();

函数:date_format(date,format), time_format(time,format)
select date_format(‘2008-08-08 22:23:01’,’%Y%m%d%H%i%s’);
select time_format(‘2008-08-08 22:23:01’,’%Y%m%d%H%i%s’);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值