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

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

WBOY
Release: 2016-06-06 09:39:05
Original
998 people have browsed it

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的值无论加不加单引号都无法实现更新

图片说明

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template