发现mysql不支持大小写
这条语句发现的问题select binary a from user where a like binary '%A%'
发现他得到的结果很多字段值是没有A的
只有小写的a 这个问题如何解决 难道一定要用regexp??(如何用这个语句如何写)
这条语句发现的问题select binary a from user where a like binary '%A%'
发现他得到的结果很多字段值是没有A的
只有小写的a 这个问题如何解决 难道一定要用regexp??(如何用这个语句如何写)
解决方案 »
- MySql客户端一闪就关了这是为什么?
- mysql最大能存储多少条记录?每条能容许多少k的数据?
- 数据库总题.答出的分你自己说要多少.
- 问问数据库用什么语言C++ 还是java?
- 针对mysql 有没有比较快的分页的方法
- 插入一条记录时,立即获得该插入的id,不锁定表是否会出错
- 用mysql-front操作mysql数据库表,插入中文乱码问题
- 怎么用ASP连接MYSQL数据库??
- 导入数据库大小有限制么
- 请问如何在mysql实现ms sql的这个语法
- (救急)mysql连接报错:ERROR 2013 (HY000): Lost connection to MySQL server during query
- insert into A values('a','b'); 这样也能插入数据??
+-------+-------------+-------------------+-------------------------------+---------+
| Field | Type | Collation | Nulleges | Comment |
+-------+-------------+-------------------+-------------------------------+---------+
| id | int(11) | NULL | NOt,insert,update,references | |
| col | varchar(30) | latin1_swedish_ci | YESt,insert,update,references | |
+-------+-------------+-------------------+-------------------------------+---------+
2 rows in set (0.02 sec)mysql> select * from t1 where col regexp 'A';
+----+--------+
| id | col |
+----+--------+
| 1 | aaaaaa |
| 2 | AAAAAA |
+----+--------+
2 rows in set (0.06 sec)mysql> alter table t1 modify col varchar(30) CHARACTER SET latin1 COLLATE latin
1_general_cs;
Query OK, 3 rows affected (0.14 sec)
Records: 3 Duplicates: 0 Warnings: 0mysql> show full columns from t1;
+-------+-------------+-------------------+------+-----+---------+-------+------
| Field | Type | Collation | Null | Key | Default | Extra | Privi
+-------+-------------+-------------------+------+-----+---------+-------+------
| id | int(11) | NULL | NO | PRI | NULL | | selec
| col | varchar(30) | latin1_general_cs | YES | | NULL | | selec
+-------+-------------+-------------------+------+-----+---------+-------+------
2 rows in set (0.02 sec)mysql> select * from t1 where col regexp 'A';
+----+--------+
| id | col |
+----+--------+
| 2 | AAAAAA |
+----+--------+
1 row in set (0.00 sec)mysql>
select * from t1 where binary col = 'A'; select * from t1 where col regexp 'A';
select * from t1 where col regexp binary'A';
总共4种情况