mysql char类型主键做查询、更新条件时遇见怪事了,求大神解答
程序员文章站
2022-06-06 16:50:35
...
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的值无论加不加单引号都无法实现更新
上一篇: WSGI协议解析