1. Use of CONCAT () function
CONCAT () function in mysql can combine multiple strings into one string
Example: select CONCAT ("vsrtdr", "farea", "qwer", "123")
Result: vsrtdrfareaqwer123
Convert decimals to percentages:
Example: select CONCAT (0.12 * 100, "%")
Result: 12.00%
2. Use of TRUNCATE (x, y) function
The TRUNCATE (x, y) function can return the value x retained to the decimal point y
Example: select TRUNCATE (0.46557443,3)
Result: 0.465
3. Then these two functions are used in combination to convert the decimal to a percentage
Example: select CONCAT (TRUNCATE (0.46557443 * 100,3), "%")
Result: 46.557%
Table of contents 1、concat 2、concat_ws 3、group_concat 1、concat 2、concat_ws Specify the splicing of the strings for strings 3、group_concat usage: group_concat ([distinct] {field to be connected} [order...
In the project encountered TRUNCATE (X, D) this function, Baidu searched are: TRUNCATE command used to delete the data in the table, but obviously the TRUNCATE (X, D) function used in the project does...
Specific use: Example: Find the percentage of a column in a table...
name Description BINARY Convert string to binary string CAST() Convert a value to a specific type CONVERT() Convert a value to a specific type Data type conversion can be achieved by CAST () and CONVE...
forward from MySQL concat() function In this tutorial, you will learn to use MySQLCONCATwithCONCAT_WSA variety of methods that connect two or more strings together. To concatenate two or more referenc...
a concat () function 1. Meaning: Concatenate multiple strings into one string. 2. Grammar: Concat(str1, str2,...) returns the result of the string generated by the connection parameter. If any of the ...
Article Directory CONCAT function in MySQL and GROUP_CONCAT 1. concat () function 1.1 MySQL's function concat Null encountered when connecting the 1.2 MySQL concat function 2, concat_ws () function 3、...
Mysql splicing field uses Concat() function. usage:Concat( par1 ,par2 ,par3,...) Return value: a string composed of par1, par2, and par3. First, use basic operations to view the return effect of the C...
Demand: Need to put the two strings together 1. Mysql in the control () function splicing string Concat (STR, STR2, STR3 ...) can put two or more parameters together Precautions: 1 Return the result i...