A tutorial on the use of concat functions in MySQL

Source: Internet
Author: User
Tags mysql tutorial

This article mainly introduces the use of concat function in MySQL tutorial, is the basic knowledge of Python introductory learning, need friends can refer to the

Use the MySQL CONCAT () function to concatenate two strings to form a single string. Try the following example:

?

1 2 3 4 5 6 7 mysql> SELECT CONCAT (' A ', ' SECOND '); +----------------------------+ | CONCAT (' A ', ' SECOND ') | +----------------------------+ | The SECOND | +----------------------------+ 1 row in Set (0.00 sec)

Learn more about the CONCAT function, considering that the EMPLOYEE_TBL table has the following records:

?

1 2 3 4 5 6 7 8 9 10 11 12-13 Mysql> SELECT * from EMPLOYEE_TBL; +------+------+------------+--------------------+ | ID | name | Work_date | Daily_typing_pages | +------+------+------------+--------------------+ | 1 | John | 2007-01-24 | 250 | | 2 | Ram | 2007-05-27 | 220 | | 3 | Jack | 2007-05-06 | 170 | | 3 | Jack | 2007-04-06 | 100 | | 4 | Jill | 2007-04-06 | 220 | | 5 | Zara | 2007-06-06 | 300 | | 5 | Zara | 2007-02-06 | 350 | +------+------+------------+--------------------+ 7 rows in Set (0.00 sec)

You can use the following command to link the name and ID in the previous table:

?

1 2 3 4 5 6 7 8 9 mysql> SELECT CONCAT (ID, name, work_date)-> from Employee_tbl; +-----------------------------+ | CONCAT (ID, name, work_date) | +-----------------------------+ | 1john2007-01-24 | | 2ram2007-05-27 | | 3jack2007-05-06 | | 3jack2007-04-06 | | 4jill2007-04-06 | | 5zara2007-06-06 | | 5zara2007-02-06 | +-----------------------------+ 7 rows in Set (0.00 sec)

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.