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

Vue implements three-level navigation display and hiding

This article example shares the specific code of ...

JavaScript custom calendar effect

This article shares the specific code of JavaScri...

About WeChat Mini Program to implement cloud payment

Table of contents 1. Introduction 2. Thought Anal...

HTML table tag tutorial (12): border style attribute FRAME

Use the FRAME property to control the style type ...

setup+ref+reactive implements vue3 responsiveness

Setup is used to write combined APIs. The interna...

HTML validate HTML validation

HTML validate refers to HTML validation. It is the...

A brief analysis of whether using iframe to call a page will cache the page

Recently, I have a project that requires using ifr...

How to use DCL to manage users and control permissions in MySQL

DCL (Data Control Language): Data control languag...

jQuery implements navigation bar effect with expansion animation

I designed and customized a navigation bar with a...

Node.js+postman to simulate HTTP server and client interaction

Table of contents 1. Node builds HTTP server 2. H...

How to implement h5 input box prompt + normal text box prompt

XML/HTML CodeCopy content to clipboard < input...

MySQL conditional query and or usage and priority example analysis

This article uses examples to illustrate the usag...