The previous article http://www.cnblogs.com/valiant1882331/p/4056403.html wrote too long, so I changed an article, link the previous section to continue
- Concatenation of strings
-
- MySQL can use" + "to splice two strings.
select 12 + 33 ", Fage '
-
select " ABC " + 123 ' , Fage + a from t_employee
view code Failed to change successful output after execution
-
- concatenation of strings in MySQL uses the concat function (concat function supports one or more parameters, Parameter types can be string types or non-string types, and for non-string-type arguments MySQL will attempt to convert it to a string type, and the Concat function will stitch the order of all parameters into a string as the return value )
select concat ( " work number: ' , Fnumber, " employee Happiness index: ' , Fsalary/ (Fage- 21 ) from t_employee
view Code Finishes executing output concat supports the use of only one parameter, The concat can be seen as a function that attempts to convert this parameter value to a string type value
- MySQL also provides another function for string concatenation concat_ws (Concat_ws can add the specified delimiter between the strings to be stitched, its first parameter value is the delimiter used, and the remaining parameter is the string value to be spliced )
Select concat_ws (',', fnumber,fage,fdepartment,fsalary) from T_ Employee
View CodeOutput of execution completion result
Database (Mssqlserver,oracle,db2,mysql) common statements and issues (cont. 1)