这真的超级奇怪,也许有人知道答案,
我有一张这样的桌子
mysql> describe sweeps;
+----------------+------------------+------+-----+---------------------+-----------------------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+------------------+------+-----+---------------------+-----------------------------+
| entity_id | int(20) unsigned | NO | PRI | NULL | auto_increment |
| fb_id | varchar(120) | YES | | NULL | |
| title | varchar(5) | YES | | NULL | |
| first_name | varchar(30) | YES | | NULL | |
| last_name | varchar(30) | YES | | NULL | |
| birthday_month | int(2) unsigned | YES | | NULL | |
| birthday_day | int(2) unsigned | YES | | NULL | |
| birthday_year | int(4) unsigned | YES | | NULL | |
| created_at | datetime | YES | | 0000-00-00 00:00:00 | |
| last_submit | timestamp | NO | | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
+----------------+------------------+------+-----+---------------------+-----------------------------+
INSERT
如果我像这样把它放在一行中,那将不接受
mysql> `sweeps` (entity_id,fb_id,title,first_name,last_name,birthday_month,birthday_day,birthday_year,created_at) VALUES (1,'fooID1','mr','John','Doe',1,1,1999,NOW());
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`sweeps` (entity_id,fb_id,title,first_name,last_name,birthday_month,birthday_day' at line 1
但奇怪的是,如果我像这样隔开它,它会毫无错误地接受它吗?为什么是这样?
mysql> INSERT INTO `sweeps` (
-> entity_id,
-> fb_id,
-> title,
-> first_name,
-> last_name,
-> birthday_month,
-> birthday_day,
-> birthday_year,
-> created_at
-> ) VALUES (
-> 1,
-> 'fooID1',
-> 'mr',
-> 'John',
-> 'Doe',
-> 1,
-> 1,
-> 1999,
-> NOW()
-> );
Query OK, 1 row affected (0.41 sec)
mysql> SELECT * FROM sweeps;
+-----------+--------+-------+------------+-----------+----------------+--------------+---------------+---------------------+---------------------+
| entity_id | fb_id | title | first_name | last_name | birthday_month | birthday_day | birthday_year | created_at | last_submit |
+-----------+--------+-------+------------+-----------+----------------+--------------+---------------+---------------------+---------------------+
| 1 | fooID1 | mr | John | Doe | 1 | 1 | 1999 | 2012-07-10 10:16:58 | 2012-07-10 10:16:58 |
+-----------+--------+-------+------------+-----------+----------------+--------------+---------------+---------------------+---------------------+
1 row in set (0.04 sec)