Home  >  Article  >  Database  >  mysql char类型主键做查询、更新条件时遇见怪事了,求大神解答

mysql char类型主键做查询、更新条件时遇见怪事了,求大神解答

WBOY
WBOYOriginal
2016-06-06 09:39:05985browse

mysql

mysql> desc card_info;
+-------------+-----------+------+-----+-------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+-----------+------+-----+-------------------+-------+
| card_number | char(20) | NO | PRI | | |
| hit_time | int(11) | NO | | 0 | |
| modify_time | timestamp | NO | | CURRENT_TIMESTAMP | |
+-------------+-----------+------+-----+-------------------+-------+

card_number做insert条件时,值需要加单引号;
做update条件时,一个长度为15的值不加单引号才能实现,一个长度为19的值无论加不加单引号都无法实现更新

图片说明

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn