Mysql DATA character connection function CONCAT

Source: Internet
Author: User

Mysql DATA character connection function CONCAT

Mysql DATA character connection function CONCAT

CONCAT () is a string connection function.
REPLACE () is a string replacement function.

CONCAT (parameter 1, parameter 2 ,...)

CONCAT (string, from_str, to_str)
Returns the str string, which is replaced by the to_str string.


The derivative functions are concat_ws (separator, string1, string2 ,...)

It differs from concat in that after a connection, there is a separator character in the connection. For example:

Update users set homedir = concat_ws ('/', '/data/disk1', 'part1', 'user1') where userid = 'user1 ';

The result is homedir = '/data/disk1/part1/user1' of user1'


CONCAT (str1, str2 ,...)

Returns the string that results from concatenating the arguments. returns NULL if any argument is NULL. may have one or more arguments. if all arguments are non-binary strings, the result is a non-binary string. if the arguments include any binary strings, the result is a binary string. A numeric argument is converted to its equivalent binary string form; if you want to avoid that you can use explicit type cast, like in this example: select CONCAT (CAST (int_col as char ), char_col)


Mysql> select CONCAT ('My, s', 'ql ');
-> 'Mysql'
Mysql> select CONCAT ('My, NULL, 'ql ');
-> NULL
Mysql> select CONCAT (14.3 );
-> '14. 3'

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.