MySql常用字元函式

2021-09-27 08:43:10 字數 1325 閱讀 5867

concat():字元連線

例:select concat(『my』,『sql』);

concat_ws():使用指定的分隔符進行字串連線

例:select concat_ws(』_』, 『my』, 『sql』);

format():數字格式化

例:select format(123456.78, 2);

lower(),upper():轉化成大小寫字母

例:select lower(『mysql』);

left(),right():獲取左側、右側字元

例:select right(『mysql』, 3);

length():獲取字串長度

例:select length(『mysql』);

ltrim(),rtrim(),trim():刪除前導空格、刪除後續空格、刪除前導和後續空格

例:select rtrim(』 mysql ');

substrimg():字串擷取

例:select substring(『mysql』,3,3)

replacr():字串替換

例:select replace(『my_sql』, 『_』, 『!*』);

相關連線:

mysql效能優化之sql語句優化

努力了這麼久,但凡有點兒天賦,也該有些成功的跡象了。

mysql常用字串 MYSQL常用字串函式寶典

mysql常用字串函式 想更進一步加強自己在查詢語句方面的能力,需要掌握常用函式。字串函式 1 concat s1,s2,sn 將s1,s2,sn串聯成乙個字串。exp root test 14 43 desc t1 field type null key default extra id int ...

MYSQL 常用字串函式

ascii str 返回值為字串str 的最左字元的數值。left str,len 返回字串str的最左面len個字元。right str,len 返回字串str的最右面len個字元。locate substr,str,pos 返回子串substr在字串str第乙個出現的位置,從位置pos開始。如果...

mysql常用字串函式

size medium color blue b 1.字串長度函式char length str length str b color size char length 返回值為字串str的長度,長度的單位為字元。乙個多位元組字元算作乙個單字元。對於乙個包含五個二位元組字符集,length 返回值為...