1、在mysql中,保留字不能作为表名,字段名等用处,如下:
mysql> alter table student add column desc varchar(16) after name;
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 'desc varchar(16) after name' at line 1
2、怎么解决这个问题?
a、使用其他的单词
b、使用倒引号,告诉mysql不要把它当做保留字解析。如下:
mysql> alter table student add column `desc` varchar(16) after name;
Query OK, 1 row affected
3、假如表名或者字段名存在保留字,导出来的sql脚本就会存在问题,导入就会出错。怎么解决这个问题?
mysql导出来的sql脚本,对于表名和字段名,统一都加上了倒引号。
相关文章
- Mysql5.7自定义函数递归报错1424 Recursive stored functions and triggers are not allowed
- 有关使用phpstudy搭建sqli-lab环境搭建时发生Uncaught Error: Call to undefined function mysql_connect()错误
- mysql if()
- mysql错误一例:ERROR 1030 (HY000): Got error 28 from storage engine
- MySQL搜索:WHERE
- mysql搜索不区分大小写
- PHP MySQL Insert Into
- mysql limit 性能问题分析
- MySQL服务相关
- 从mysql中拿到的数据构造为列表