在t_employee表中,练习使用concat函数连接字符串时,

mysql> select concat('工号为:',fnumber,'的员工的幸福指数:',fsalary/(fage-21))
-> from t_employee;
1271 - Illegal mix of collations for operation 'concat'   报错

在网上查看了相关错误文章发现是字段得字符集有问题,我这里的fnumber字段的字符集是latin1,而字段操作默认为UTF8的编码。 绝对统一使用UTF-8 。

修改了字符集为utf-8后再次运行SQL命令

mysql> select concat('工号为:',fnumber,'的员工的幸福指数:',fsalary/(fage-21))
-> from t_employee;
+-----------------------------------------------------------------+
| concat('工号为:',fnumber,'的员工的幸福指数:',fsalary/(fage-21)) |
+-----------------------------------------------------------------+
| 工号为:dev001的员工的幸福指数:2075.000000 |
| 工号为:dev002的员工的幸福指数:328.685714 |
| 工号为:HR001的员工的幸福指数:1100.400000 |
| 工号为:HR002的员工的幸福指数:1300.090000 |
| 工号为:IT001的员工的幸福指数:557.142857 |
| 工号为:IT002的员工的幸福指数:466.666667 |
| 工号为:sales001的员工的幸福指数:2500.000000 |
| 工号为:sales002的员工的幸福指数:885.714286 |
| 工号为:sales003的员工的幸福指数:1200.000000 |
+-----------------------------------------------------------------+
9 rows in set

搜索出来的数据是正确的,没有报错。

Illegal mix of collations for operation 'concat'的更多相关文章

  1. mysql5.6修改字符编码,ERR:Illegal mix of collations for operation 'concat'

    mysql5.6修改字符编码,ERR:Illegal mix of collations for operation 'concat' 1.问题起因:搭建环境初始化mysql的时候看到mysql配置文 ...

  2. MySQL Error: Illegal mix of collations for operation 'concat'

    在使用concat连接字符串时出现错误:MySQL Error: Illegal mix of collations for operation 'concat' 原因:字段操作默认为UTF8的编码, ...

  3. Illegal mix of collations for operation 'like' while searching with Ignited-Datatables

    Stack Overflow Questions Developer Jobs Tags Users   Log In Sign Up Join Stack Overflow to learn, sh ...

  4. mysql 客户端连接报错Illegal mix of collations for operation

    服务端用的是utf-8,客户端工具打开表和视图是会报Illegal mix of collations for operation错误,经排查,可以采用以下语句解决 SET character_set ...

  5. 错误之Illegal mix of collations for operation 'like'

    内容来自博客:https://www.cnblogs.com/install/p/4417527.html MySQL Illegal mix of collations for operation ...

  6. myslq数据库用union all查询出现 #1271 - Illegal mix of collations for operation 'UNION'

    出现 #1271 - Illegal mix of collations for operation 'UNION' 的原因是两个字符编码不匹配造成的. 我遇到的是  utf8_general_ci ...

  7. mysql提示:Illegal mix of collations for operation ‘UNION’

    http://www.111cn.net/database/mysql/56096.htm show variables like "%char%"; show variables ...

  8. 有关mysql的utf8和utf8mb4,以及Illegal mix of collations for operation 'like'

    参考以下几个帖子: https://www.cnblogs.com/install/p/4417527.html https://blog.csdn.net/Yetmoon/article/detai ...

  9. Mysql Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '='

    MySQL字符串比较bug: select * from table_a a left join table_b b on a.field_a = b.field_b   error: Illegal ...

随机推荐

  1. 从LeNet到SENet——卷积神经网络回顾

    从LeNet到SENet——卷积神经网络回顾 从 1998 年经典的 LeNet,到 2012 年历史性的 AlexNet,之后深度学习进入了蓬勃发展阶段,百花齐放,大放异彩,出现了各式各样的不同网络 ...

  2. Entries missing in table T028G T-CODE: OT51 SAP 传输配置操作为用户操作 SAP网银接口

    change this setting as a 'current setting' according to SAP note '135028 - Transfer IMG activity to ...

  3. Zend Framework2 入门教程(转)

    转载自: http://my.oschina.net/lai1362000/blog/201301 重申:这本书作者的截图我都放上去了,没侵权啊. 别问那么多,我只是一个安静的搬砖工. 摘要 Zend ...

  4. JUnit规则

    在本节中,我们学习和了解JUnit中叫做规则的新功能,它允许非常灵活在测试类重新定义每个测试方法的行为.为了这个目的,@Rule注解被使用来标出测试类的公共字段.这些字段类型为MethodRule,这 ...

  5. e790. 设置JSpinner的边框

    // Create a number spinner JSpinner spinner = new JSpinner(); // Get the text field JFormattedTextFi ...

  6. Win7下Netsh虚拟Wi-Fi

    Netsh的字面意思是网络外壳,其实它是一个命令行实用程序,最初出现于Windows 2000操作系统,它可以帮助管理WINDOWS中的网络设置.此后,微软不断对它进行改进,给它增加了一些新的命令集. ...

  7. PyQt的图片资源的路径问题。

    百度到的PyQt的添加资源大部分都是通过Qt Creater添加资源的,适用于拖拽形成的界面. 问题一:纯粹手写的界面,添加资源呢? 文件夹路径: |----img |--aa.jpg |----vi ...

  8. 每天一个linux命令:cd命令

    Linux cd 命令可以说是Linux中最基本的命令语句,其他的命令语句要进行操作,都是建立在使用 cd 命令上的. 所以,学习Linux 常用命令,首先就要学好 cd 命令的使用方法技巧. 1. ...

  9. C# 获取文件夹下的所有文件的文件名

    String path = @"X:\xxx\xxx"; //第一种方法 var files = Directory.GetFiles(path, "*.txt" ...

  10. Hotspot JVM的常用选项

    Hotspot JVM的常用选项 选项的分类 Hotspot JVM提供以下三大类选项: 1. 标准选项:这类选项的功能是很稳定的,在后续版本中也不太会发生变化.运行java或者java -help可 ...