求教key_len是4是怎么算的,数据库编码为utf8mysql> desc t1;
+-------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+-------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| assist_id | int(11) | NO | | NULL | |
| assist_name | varchar(50) | YES | | NULL | |
+-------------+-------------+------+-----+---------+----------------+mysql> explain
-> select * from t1 where id > 1 and id < 5;
+----+-------------+-----------------------+-------+---------------+---------+---------+------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-----------------------+-------+---------------+---------+---------+------+------+-------------+
| 1 | SIMPLE | t1 | range | PRIMARY | PRIMARY | 4 | NULL | 1 | Using where |
+----+-------------+-----------------------+-------+---------------+---------+---------+------+------+-------------+
1 row in set (0.00 sec)
+-------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+-------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| assist_id | int(11) | NO | | NULL | |
| assist_name | varchar(50) | YES | | NULL | |
+-------------+-------------+------+-----+---------+----------------+mysql> explain
-> select * from t1 where id > 1 and id < 5;
+----+-------------+-----------------------+-------+---------------+---------+---------+------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-----------------------+-------+---------------+---------+---------+------+------+-------------+
| 1 | SIMPLE | t1 | range | PRIMARY | PRIMARY | 4 | NULL | 1 | Using where |
+----+-------------+-----------------------+-------+---------------+---------+---------+------+------+-------------+
1 row in set (0.00 sec)
解决方案 »
- 求助mysql读取一小时之前数据问题,谢谢
- MySQL新手,存储过程问题老是报错,请高手帮忙解答一下为什么?急!!!
- 请各位介绍几本学习数据库的经典教程,国内外的都可以,谢谢啦!!!
- mysql 存储过程 的PHP调用
- sum求和的语句,sum()在where中?
- 用mysql administrator导入PHPmyadmin导出的SQL
- 等级字段值加一,条件是当前时间大于数据库时间
- [mysql]5.0的存储过程怎么实现原子操作
- 用Mysql++查询数据库,查询语句太长就会出问题,怎么办
- linux 下mysql连接数问题(急...如方法好本人愿再加分.多少你说了算)
- update 更新时需要查询本表,sql语句怎么写
- 模糊查询出错
INT数据类型,而INT是4字节。或者楼主描述一下自己是如何理解的。