#拼接字符串 SELECT CONCAT(`name`,intro) FROM edu_teacher; #查看某字段的字节数 SELECT intro,LENGTH(intro) FROM edu_teacher; #查询字段的字符长度 SELECT intro,CHAR_LENGTH(intro) FROM edu_teacher; #截取前3个字符 SELECT intro,SUBSTR(intro,1,3) FROM edu_teacher; #查询子字符串 在父字符串第一次出现的索引 SELECT INSTR("是谁偷了我的工作","工作") AS 索引; # 去除字符串两边指定的字符串;默认去除两边空格 SELECT TRIM(" 无所事 事 ") AS 去除后; SELECT TRIM('x' FROM "xxxxxxa无所事 事xxxxxxx") AS 去除后; # 当不够指定大小的字符长度时,则填充指定字符 SELECT LPAD("123",10,"x"); SELECT RPAD("123",10,"x");