Database (Mssqlserver,oracle,db2,mysql) common statements and issues (cont. 1)

Source: Internet
Author: User
Tags mssqlserver

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

    1. Concatenation of strings
      • MySQL can use" + "to splice two strings.
         select    12    +    33   ", Fage '   

    1.  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 Code

      Output of execution completion result

Database (Mssqlserver,oracle,db2,mysql) common statements and issues (cont. 1)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.