Illegal mix of collations for operation ' Concat '

Source: Internet
Author: User

In the T_employee table, when you practice using the CONCAT function to concatenate strings,

Mysql> Select Concat (' Work number: ', Fnumber, ' Employee's Happiness Index: ', fsalary/(fage-21))
From T_employee;
1271-illegal mix of collations for operation ' Concat ' ERROR

On the web to see the related error article found that there is a problem with the character set of the field, my Fnumber field here is Latin1, and the field Operation defaults to UTF8 encoding. Absolute uniform use of UTF-8.

After you modify the character set to Utf-8, run the SQL command again

Mysql> Select Concat (' Work number: ', Fnumber, ' Employee's Happiness Index: ', fsalary/(fage-21))
From T_employee;
+-----------------------------------------------------------------+
| Concat (' Work number: ', Fnumber, ' Employee's Happiness Index: ', fsalary/(fage-21)) |
+-----------------------------------------------------------------+
| Work Number: DEV001 's employee's happiness index: 2075.000000 |
| Work Number: DEV002 's employee's happiness index: 328.685714 |
| Work Number: HR001 's employee's happiness index: 1100.400000 |
| Work Number: HR002 's employee's happiness index: 1300.090000 |
| Work Number: IT001 's employee's happiness index: 557.142857 |
| Work Number: IT002 's employee's happiness index: 466.666667 |
| Work Number: SALES001 's employee's happiness index: 2500.000000 |
| Work Number: SALES002 's employee's happiness index: 885.714286 |
| Work Number: Sales003 's employee's happiness index: 1200.000000 |
+-----------------------------------------------------------------+
9 Rows in Set

The search data is correct, no error.

Illegal mix of collations for operation ' Concat '

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.