#String concatenation concat(s1,s2); concatenate the strings in last_name and first_name in the table select concat(last_name,first_name) as name from employees; #Only last_name will be modified, not first_name SELECT first_name,last_name AS f FROM employees; # Separate the two columns with a comma and name them out_put SELECT CONCAT(`last_name`,',',`phone_number`) AS out_put FROM employees; #ifnull determines whether it is empty. If it is empty, it will be displayed as 0 instead of null, and the column name will be displayed as the result SELECT IFNULL(commission_pct,0) AS result FROM employees; Content extension: String concatenation 1.1 The CONCAT(s1, s2, ...) function returns the string generated by concatenating the parameters, one or more contents to be concatenated. If any one of them is NULL, the return value is NULL. SELECT CONCAT('Current time:',NOW()); -- Output result: Current time: 2019-01-17 11:27:58 1.2 CONCAT_WS(x,s1,s2,...) function Returns a string consisting of multiple strings concatenated together, with an x between each string. SELECT CONCAT_WS(';','pan_junbiao's blog','KevinPan','pan_junbiao'); -- Output: pan_junbiao's blog;KevinPan;pan_junbiao I hope the above content can help everyone. Thank you for your support of 123WORDPRESS.COM. You may also be interested in:
|
<<: Vue component encapsulates sample code for uploading pictures and videos
>>: How to build a K8S cluster and install docker under Hyper-V
1. Download address: http://dev.mysql.com/downloa...
The rewrite module is the ngx_http_rewrite_module...
Basic preparation For this implementation, we nee...
Use scenarios: The jump path needs to be dynamica...
Database read-write separation is an essential an...
1. Advantages and Disadvantages of Indexes Advant...
This article shares the specific code of jQuery t...
The scope of nginx configuration instructions can...
Block element HTML tag classification details * a...
Preface The default database file of the MySQL da...
Prerequisites for installing MySQL: Install CentO...
Read-only and disabled attributes in forms 1. Rea...
This article shares the Vue calculation property ...
Preface After deploying the server, I visited my ...
This article uses an example to describe how to a...