mysql数据库如果表的字段名用的是关键字例desc会报错处理:
一般情况下要避免使用关键字作为MySQL表的字段名
mysql> update role set desc='张三' where id =1000;
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 'desc='青苗项目助学导师' where id =5' at line 1
mysql> update role set desc=’张三‘ where id =1000;
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 'desc=’青苗项目助学导师‘ where id =5' at line 1
如果不能更改了字段,在使用SQL语句时候,只能利用反引号转义,键盘左上角的反引号
update role set `desc`=’张三‘ where id =1000;
评论列表