MySQL 中空格大小写不敏感

MySQL 中空格大小写不敏感

..............................mysql

  1. MySQL 对字符串的后置空格是不敏感的,前置空格敏感sql

  2. 'dd','dd ',用select * from t_list where str='dd';获取这两个结果(说明MySQL查询的时候,mysql有作righttrim的操做).net

  3. ' dd','dd',用select * from t_list where str='dd';获取这第二个结果(说明MySQL前置空格不敏感)code

  4. 'dd','dd ',用 select str,LENGTH(str) from t_list; 结果为2,3,(说明查询结果中,空格的是包含在其中的。)blog

  5. 解决方法在字段前面添加 binary 关键字。'dd','dd 'select str,LENGTH('dd','dd ',) from t_list where str=Binary('dd'); 获取结果 'dd',2字符串

这篇文章比较详细,能够参考这篇文章get

相关文章
相关标签/搜索