问题描述:
在用MySQL测试某个程序的时候总是报错,创建表的语句如下:
mysql> create table EDUCATION (EMPLOYEE_ID integer not null, SCHOOL varchar(255), RANGE varchar(255) not null, primary key (EMPLOYEE_ID, RANGE)) ENGINE=InnoDB;
报错如下:
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 'RANGE varchar(255) not nu
ll, primary key (EMPLOYEE_ID, RANGE)) ENGINE=InnoDB' at line 1
原因:
经仔细分析发现Range为MySQL保留字,修改为PERIOD问题解决