This article mainly introduces the Mysql sql statement that maintains the existing content and adds content later. Friends who need it can refer to
The function of this command is to modify the data table ff_vod. Add 999999999 after the vod_url field content.
update ff_vod set vod_url=CONCAT(vod_url,'999999999') where vod_id BETWEEN 1 AND 42553
The following statement is used to modify only the content with vod_id 1-42553.
where vod_id BETWEEN 1 AND 42553
In fact, this mainly uses the CONCAT function. The mysql CONCAT() function is used to connect multiple strings into one string.
The following will take you to understand the mysql CONCAT() function
mysql CONCAT() function is used to concatenate multiple strings into one string, which is the most important One of the mysql functions, the mysql CONCAT() function will be introduced in detail for your reference below
mysql CONCAT(str1,str2,…)
The return result is the string generated by the connection parameter. If any parameter is NULL, the return value is NULL. There may be one or more parameters. If all arguments are non-binary strings, the result is a non-binary string. If the self variable contains any binary string, the result is a binary string. A numeric argument is converted to its equivalent binary string format; to avoid this, use an explicit type cast, for 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′
mysql CONCAT_WS(separator,str1,str2,…)
CONCAT_WS() represents CONCAT With Separator and is a special form of CONCAT(). The first parameter is the delimiter of other parameters. The position of the delimiter is placed between the two strings to be concatenated. The delimiter can be a string or other parameters. If the delimiter is NULL, the result is NULL. The function ignores NULL values after any delimiter argument.
mysql> SELECT CONCAT_WS(',','First name','Second name','Last Name'); -> ‘First name,Second name,Last Name' mysql> SELECT CONCAT_WS(',','First name',NULL,'Last Name'); -> ‘First name,Last Name'
mysql CONCAT_WS() will not ignore any empty string. (However, all NULLs are ignored).
【Related recommendations】
1. Free mysql online video tutorial
2. MySQL latest manual tutorial
3. Those things about database design
The above is the detailed content of Mysql tutorial on using sql statements to add content after the original content. For more information, please follow other related articles on the PHP Chinese website!