mysql的一些语句

 

右补0:select RPAD(id,8,'0') as pad from tablename; 

左补0:select LPAD(id,8,'0') as pad from tablename;

字符串连接:update tableName set title=CONCAT(‘abc’,title,’def’) WHERE id=1

字符串截取【一】:select left(title,50) from tablename

字符串截取【二】:

select substring(title,5) as newTitle from tablename

select substring(title,5,100) as newTitle from tablename

字符串截取【三】:select substring_index(title,'@') as newTitle from tablename

 

 

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注