SQL中concat實現字串拼接

2021-10-01 01:38:22 字數 517 閱讀 3360

concat(str1,str2,…) 

返回結果為連線引數產生的字串。如有任何乙個引數為null ,則返回值為 null。

注意:

如果所有引數均為非二進位制字串,則結果為非二進位制字串。

如果自變數中含有任一二進位制字串,則結果為乙個二進位制字串。

mysql的concat函式可以連線乙個或者多個字串,如

mysql> select concat('10');

結果: 10

mysql> select concat('11','22','33');

結果: 112233

mysql的concat函式在連線字串的時候,只要其中乙個是null,那麼將返回null

mysql> select concat('11','22',null);

結果: null

SQL優化 字串拼接concat與

sql select concat abc def from dual concat abcdef sql select abc def from dual abc abcdef sql select abc def ghi from dual abc d abcdefghi sql select ...

MySQL中concat函式(連線字串)

mysql中concat函式 使用方法 concat str1,str2,返回結果為連線引數產生的字串。如有任何乙個引數為null 則返回值為 null。mysql select concat 11 22 33 concat 11 22 33 112233 1 row in set 0.00 sec...

字串拼接 和concat的區別

和concat都可以用來拼接字串,但在使用上有什麼區別呢,先來看看這個例子。public static void main string args concat原始碼 public string concat string str int len value.length char buf arra...