情况
给mysql新增字段,使用语句如下:
ALTER TABLE t_quality_inspection ADD COLUMN logr_dev decimal(20,5), ADD COLUMN p10gc decimal(20,5)
报错如下:
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 (20,5) ADD COLUMN p10gc decimal(20,5) at line 1
原因
从语句看 完全没有问题。
主要是看操作的编辑器,我用的mysql-front,原来类型关键字 需要 与 字段名 保持一定的距离才能够被识别出来。
如图,一个decimal(20,5)被识别成关键字 ,一个未被识别。
解决方法
关键字前多打几个空格