+------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| desc | varchar(100) | NO | | NULL | |
+------------+--------------+------+-----+---------+----------------+
对于这样的表,如果插入 id 为 0 的纪录,会插入成功,但插入的纪录 id 不为 0 而是自增后的值,但是 id 为-1 时,则能成功插入并且 id=-1 ,这是为什么?
insert into content_cornermark set id=-1, content_cornermark.desc='无';
1
geeglo 2016-01-11 20:01:27 +08:00
-1 在 int 的范围中
|
2
msg7086 2016-01-12 02:15:20 +08:00 1
Let me google that for you:
http://stackoverflow.com/a/1142588 |