Mysql CONCAT () connection string

Source: Internet
Author: User
Tags mysql tutorial

Mysql tutorial concat () connection string details
In some cases, If you want two or more strings, there is a string connection function concat () in mysql. Let's talk about how to use it.

Concat syntax
Concat (str1, str2 ,...)

Connect two strings in a simple instance

Select concat ('hello', 'World! ');

Of course, you can also use fields in the table instead of string constants. You can use them together. Let's take a look at a slightly complex example. Assume that we have a name and age in the User table, and now we want to connect them together, we can use select statement uses the concat

Select concat (name, 'is ', age, 'ears old.') from user;

Bill is 28 years old.
Mark is 32 years old.
Julia is 44 years old.
Alex is 52 years old.

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.