Mysql keeps the existing content and adds content later

Mysql keeps the existing content and adds content later

This command modifies the data table ff_vod and adds 999999999 after the content of the vod_url field.

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

123WORDPRESS.COM editor analysis:

In fact, this mainly uses the CONCAT function. The MySQL CONCAT() function is used to concatenate multiple strings into one string.

The following will show you how to use the MySQL CONCAT() function.

The MySQL CONCAT() function is used to concatenate multiple strings into one string. It is one of the most important MySQL functions. The following will introduce the MySQL CONCAT() function in detail for your reference.

mysql CONCAT(str1,str2,…)
The return value is a string resulting from the concatenation of the parameters. If any parameter is NULL, the return value is NULL. There may be one or more parameters. If all arguments are nonbinary strings, the result is a nonbinary string. If the argument 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() stands for CONCAT With Separator and is a special form of CONCAT(). The first parameter is the separator for the other parameters. The delimiter is placed between the two strings to be concatenated. The separator can be a string or other parameters. If delimiter is NULL, the result is NULL. The function ignores any NULL values ​​following the separator parameter.

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() does not ignore any empty strings. (However, any NULL values ​​are ignored).

<<:  10 minutes to thoroughly understand WeChat applet single page application routing

>>:  How to implement second-level scheduled tasks with Linux Crontab Shell script

Recommend

Method and introduction of table index definition in MySQL

Overview An index is a table of correspondence be...

Create an SSL certificate that can be used in nginx and IIS

Table of contents Creating an SSL Certificate 1. ...

A simple explanation of MySQL parallel replication

1. Background of Parallel Replication First of al...

ftp remotely connect to Linux via SSH

First install ssh in Linux, taking centos as an e...

Detailed tutorial on installing MySQL 8.0.19 in zip version on win10

Table of contents 1. After downloading, unzip it ...

HTML uses form tags to implement the registration page example code

Case Description: - Use tables to achieve page ef...

Implementation of grayscale release with Nginx and Lua

Install memcached yum install -y memcached #Start...

How to configure Linux to use LDAP user authentication

I am using LDAP user management implemented in Ce...

Neon light effects implemented with pure CSS3

This is the effect to be achieved: You can see th...

Vue uses canvas to realize image compression upload

This article shares the specific code of Vue usin...

MySQL briefly understands how "order by" works

For sorting, order by is a keyword we use very fr...