例如 INT 这个词在MYSQL里面是保留关键字现有一个表table1,其有一个字段名字为int那么如果这样写的话就会出错UPDATE table1 SET int=419 WHERE xxxx=xxx;引号括起来也不行UPDATE 'table1' SET 'int'=419 WHERE 'xxxx'=xxx;错误信息#1064 - 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 ......
用反引号。在键盘上数字键1 的左边。mysql> select * from t_lscxp;
+------+------+
| int | col1 |
+------+------+
| 1 | 10 |
| 2 | 20 |
+------+------+
2 rows in set (0.00 sec)mysql> UPDATE table1 SET `int`=419 WHERE col1=10;
ERROR 1146 (42S02): Table 'csdn.table1' doesn't exist
mysql> select * from t_lscxp;
+------+------+
| int | col1 |
+------+------+
| 1 | 10 |
| 2 | 20 |
+------+------+
2 rows in set (0.00 sec)mysql>